Skip to content

AIDK API Reference / aidk-react

aidk-react ​

AIDK React ​

React hooks and components for building AI-powered UIs. Provides state management for agent execution, real-time streaming, and content block rendering.

Hooks ​

  • useEngineClient - Manage client connection lifecycle
  • useExecution - Execute agents and stream responses
  • useChannel - Subscribe to real-time channels

Components ​

  • ContentBlockRenderer - Render any content block type
  • ContentBlockList - Render arrays of content blocks
  • TextBlock, ImageBlock, CodeBlock - Individual block renderers

Quick Start ​

tsx
import { useEngineClient, useExecution } from 'aidk-react';

function ChatApp() {
  const { client } = useEngineClient({
    baseUrl: 'http://localhost:3001',
    userId: 'user-123',
  });

  const { sendMessage, messages, isStreaming } = useExecution({
    client,
    agentId: 'my-agent',
  });

  return (
    <div>
      {messages.map(msg => <Message key={msg.id} {...msg} />)}
      <input onSubmit={(e) => sendMessage(e.target.value)} />
    </div>
  );
}

See ​

Interfaces ​

InterfaceDescription
ContentBlockListProps-
ContentBlockRendererProps-
UseEngineClientOptions-
UseEngineClientReturn-
UseExecutionOptions-
UseExecutionReturn-

Functions ​

FunctionDescription
clearChannelCacheClear all cached channels (useful for testing or logout scenarios)
CodeBlock-
ContentBlockListRenders a list of content blocks
ContentBlockRendererRenders a single content block based on its type
ImageBlock-
PlaceholderBlock-
ReasoningBlock-
TextBlockTextBlock component - displays text content from AI responses.
ToolResultBlock-
ToolUseBlock-
useChannelReact hook for typed channel communication
useEngineClientHook to get an Engine Client instance
useExecutionHook for managing agent execution with message accumulation

References ​

Channel ​

Re-exports Channel


ChannelClient ​

Re-exports ChannelClient


ChannelClientConfig ​

Re-exports ChannelClientConfig


ChannelDefinition ​

Re-exports ChannelDefinition


ChannelEvent ​

Re-exports ChannelEvent


ChannelTransport ​

Re-exports ChannelTransport


ConnectionInfo ​

Re-exports ConnectionInfo


ConnectionState ​

Re-exports ConnectionState


ContentBlock ​

Re-exports ContentBlock


createEngineClient ​

Re-exports createEngineClient


defineChannel ​

Re-exports defineChannel


EngineClient ​

Re-exports EngineClient


EngineClientConfig ​

Re-exports EngineClientConfig


EngineInput ​

Re-exports EngineInput


EngineRoutes ​

Re-exports EngineRoutes


EngineStreamEvent ​

Re-exports EngineStreamEvent


ExecutionResult ​

Re-exports ExecutionResult


getEngineClient ​

Re-exports getEngineClient


Message ​

Re-exports Message


SSETransport ​

Re-exports SSETransport


SSETransportConfig ​

Re-exports SSETransportConfig


TimelineEntry ​

Re-exports TimelineEntry


TransportInfo ​

Re-exports TransportInfo


TransportState ​

Re-exports TransportState

Released under the MIT License.