React & Angular API
The hooks, props, services, and inputs exposed by the UI SDKs. For a walkthrough of setting these up, see Using Distri in your product.
- React
- Angular
Hooks
| Hook | Description |
|---|---|
useAgent() | Load an agent by id or definition. |
useChat() | Full chat state: messages, streaming, and tools. |
useChatMessages() | Access the message history. |
useDistri() | The DistriClient, loading state, and errors. |
useThreads() | List and manage conversation threads. |
useWorkspace() | Get and set the active workspace. |
useWorkflow() | Drive a workflow and read step progress. |
<Chat> props
| Prop | Type | Description |
|---|---|---|
agent | Agent | From useAgent(). |
threadId | string | Conversation to attach to. |
externalTools | DistriAnyTool[] | Your product's tools. |
enableHistory | boolean | Load prior messages for the thread. |
getMetadata | () => Promise<object> | Inject dynamic context each message. |
onChatInstanceReady | (instance) => void | Get a handle to the chat instance. |
Services (plain factory functions)
| Export | Description |
|---|---|
provideDistri(config) | Register the client in DI. Takes a token endpoint, a direct config, or an async factory. |
DISTRI_SERVICE | Inject to read client, isLoading, error as Signals; setWorkspaceId(). |
createChatService() | Signal-based chat state. |
createAgentService() | Load and manage agents. |
<distri-chat> inputs
| Input | Type | Description |
|---|---|---|
agentIdOrDef | string | AgentDefinition | Required. Agent to run. |
threadId | string | Required. Conversation to attach to. |
externalTools | DistriBaseTool[] | Your product's tools. |
beforeSendMessage | (m) => Promise<m> | Rewrite the outgoing message. |
starterPrompts | string[] | Example prompts on the empty state. |