FluxyChat

Core SDK

AI Agents

Invoke agents in rooms, REST invoke, and handoff.

Agents are configured on the Worker (dashboard or admin API). Clients invoke them. There is no client.createAgent() in the SDK.

Configure on the Worker

Create agents with admin JWT:

curl -X POST "$FLUXY_BASE_URL/agents" \
  -H "Authorization: Bearer $ADMIN_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Assistant",
    "handle": "assistant",
    "provider": "openai",
    "model": "gpt-4o-mini",
    "capabilities": ["chat"]
  }'

Agents with a handle (e.g. @assistant) auto-invoke when users mention them in a room message.

Invoke from useChat

const { invokeAgent } = useChat({ roomId, client });

await invokeAgent("agent-id", "What is our refund policy?");

Invoke via REST

await client.invokeAgentRest(agentId, roomId, "Summarize the last 10 messages");

Requires member JWT on the client.

Several agents in one room

invokeAgent can run more than one agent on the same roomId. Each call counts against the project's monthly agent_invokes quota (Free includes 5k). Handles (@assistant) auto-invoke from mentions and count the same way.

Four concurrent agents (a restaurant floor, a war room) is a product pattern, not a second protocol. Watch quota and rate limits in the operator console.

Handoff

Check whether a human should take over:

const handoff = await client.getRoomHandoff(roomId);
// { shouldHandoff, reason?, suggestedAssignee? }

Streaming

When the provider supports it, agent replies stream as message edits over WebSocket (streaming: true on message rows). Tool calls appear as structured cards in the thread when toolExecuteUrl is set.

Next steps

On this page