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 ​
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 ​
- useEngineClient - Client connection hook
- useExecution - Agent execution hook
- ContentBlockRenderer - Block rendering component
Interfaces ​
| Interface | Description |
|---|---|
| ContentBlockListProps | - |
| ContentBlockRendererProps | - |
| UseEngineClientOptions | - |
| UseEngineClientReturn | - |
| UseExecutionOptions | - |
| UseExecutionReturn | - |
Functions ​
| Function | Description |
|---|---|
| clearChannelCache | Clear all cached channels (useful for testing or logout scenarios) |
| CodeBlock | - |
| ContentBlockList | Renders a list of content blocks |
| ContentBlockRenderer | Renders a single content block based on its type |
| ImageBlock | - |
| PlaceholderBlock | - |
| ReasoningBlock | - |
| TextBlock | TextBlock component - displays text content from AI responses. |
| ToolResultBlock | - |
| ToolUseBlock | - |
| useChannel | React hook for typed channel communication |
| useEngineClient | Hook to get an Engine Client instance |
| useExecution | Hook 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