Files
Benjamin Taylor fb2162f286 docs(showcase): state the frontend-tool requirement per framework
`generative-ui/tool-based` is now the terminal page every onboarding run fetches
(OSS-1034), and its "How it works in code" section is a bundled
`frontend-tools-setup` concept. Only 5 of 19 frameworks shipped one, so for the
rest the section rendered nothing and absence encoded two different facts: this
framework needs no agent-side wiring, or it needs some and nobody wrote it down.

Four frameworks whose own gen-ui-tool-based demo agent settles the question get
a snippet. pydantic-ai, llamaindex and ms-agent-python declare no tools at all --
the AG-UI request forwards them and their demo agents say so in as many words --
so their snippet states that, and then states the half that is easy to miss: a
model with no instruction about the tool answers in prose and the component never
renders. CrewAI is the opposite case. A Flow owns its own model call, so it has
to read `state.copilotkit.actions` and pass them itself, wrap the call in
`copilotkit_stream`, and drive `tool_choice`.

A compile failure in a bundled snippet no longer returns null. It shared that
return with "nobody bundled this", so a rendering defect shipped looking exactly
like a deliberate omission, traceable only through a console.error nobody reads
in production. Absence stays quiet; a broken snippet throws.

The nine frameworks still undetermined are named in a list a test reads, so a new
framework cannot join the gap silently and closing one means deleting a name.

Refs OSS-1036

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 15:25:12 -05:00

37 lines
1.0 KiB
Plaintext

<Steps>
<Step>
### Nothing to wire on the agent
CopilotKit's runtime forwards frontend tool definitions to the agent at
request time, so the agent can call a component registered with
`useComponent` by name. There are no backend tools to declare.
```python title="src/agents/chart_agent.py"
from agent_framework import Agent
agent = Agent(
chat_client=chat_client,
instructions=SYSTEM_PROMPT,
)
```
</Step>
<Step>
### Tell the model when to call it
The agent's job here is to recognize the intent in the user's message and
emit a tool call with structured data. Say so in the instructions, or the
model will answer in prose and the component will never render.
```python title="src/agents/chart_agent.py"
SYSTEM_PROMPT = """
You are a data visualization assistant.
When the user asks for a chart, call `render_bar_chart` with a concise
title and a `data` array of `{label, value}` items.
"""
```
</Step>
</Steps>