Skip to main content

Overview

CrewForm supports the AG-UI (Agent-User Interaction) protocol, enabling real-time streaming of agent execution events to any compatible frontend via Server-Sent Events (SSE).
AG-UI complements MCP (tools) and A2A (agents) — together they form the three agentic protocols that CrewForm supports.

How It Works

When a CrewForm agent executes a task, the task runner emits structured AG-UI events through an SSE endpoint. Any frontend — CrewForm’s dashboard, a custom app, or a CopilotKit integration — can subscribe and display execution in real-time.

Event Types

Rich Interactions

AG-UI supports bidirectional communication — agents can pause execution, present choices to the user, and resume based on user input.

Interaction Types

How It Works

INTERACTION_REQUEST Event

When an agent requests input, the SSE stream emits:
For confirm_data, includes a data object. For choice, includes a choices array.

Submitting a Response

Body:
For confirm_data, include data with modified values. For choice, include selectedOptionId.

React Hook Usage

The useAgentStream hook handles interactions automatically:

Timeout Behavior

  • Default timeout: 5 minutes per interaction
  • When the timeout expires, the agent emits INTERACTION_TIMEOUT and the task fails
  • The task status transitions: runningwaiting_for_inputfailed
  • Timeout duration is included in the INTERACTION_REQUEST event

Authentication

AG-UI uses the same Bearer token auth as A2A — provide an API key from your workspace’s api_keys table (provider: ag-ui or a2a).

Important Notes

  • The SSE stream is real-time only — connect before or during task execution
  • Events stream for the duration of task execution and close on completion
  • The threadId maps to a CrewForm task ID
  • Works with any AG-UI-compatible client, including CopilotKit
  • Rich interactions require a connected SSE client to display the modal — if no client is connected, the interaction will time out

Request

Headers:
Body (RunAgentInput):

Response

The endpoint returns text/event-stream with AG-UI events:

Quick Test

Health Check

Stream Events

React Hook

CrewForm includes a useAgentStream React hook for consuming AG-UI events:

Hook Return Values