AG-UI
Use this skill to implement AG-UI compliant integrations with correct event ordering, tool lifecycle behavior, and state synchronization semantics.
Quick Triage
- •Use this skill when the task is protocol-level integration between agent backend and UI client.
- •Switch to
$langgraphwhen graph orchestration/checkpoint logic is the primary issue. - •Switch to
$langchainwhen chain or tool orchestration internals are the primary issue. - •Switch to
$copilotkitwhen CopilotKit hooks/provider behavior is primary.
Workflow
- •Define integration mode.
Choose client-side
HttpAgent, customAbstractAgent, or middleware bridge. - •Lock event subset and ordering. Map required lifecycle, text, tool, and state events before implementation.
- •Implement lifecycle first.
Guarantee
RUN_STARTEDandRUN_FINISHED/RUN_ERRORframing around all runs. - •Implement message and tool streams. Ensure tool call start/args/end/result sequence is valid and complete.
- •Implement state synchronization. Choose snapshot-only, delta-only, or hybrid strategy intentionally.
- •Add middleware with explicit order. Enforce auth, filtering, and logging without mutating protocol invariants.
- •Validate against event traces. Use deterministic replay to confirm ordering and payload shape.
Default Patterns
- •Emit minimal valid event streams rather than custom ad-hoc payloads.
- •Keep tool result payloads parseable and bounded.
- •Prefer explicit event schemas over inferred client parsing.
- •Keep protocol payloads transport-agnostic.
Failure Modes
- •Out-of-order lifecycle or tool events.
- •Partial tool-call streams without terminal result events.
- •State delta application mismatch on client.
- •Middleware mutating payloads into non-compliant shapes.
Reference Map
Load only what is needed for the current subtask.
- •Event contracts:
references/event-contracts.md - •State sync strategy:
references/state-sync.md - •Middleware usage:
references/middleware-patterns.md - •Integration checklist:
references/integration-checklist.md