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

41 lines
1.2 KiB
Plaintext

<Steps>
<Step>
### Nothing to wire on the agent
PydanticAI's AG-UI bridge surfaces frontend-registered tools to the model on
every run, so the agent declares no tools of its own. A component registered
with `useComponent` reaches the model through the AG-UI request payload and
the model calls it by name.
```python title="src/agents/chart_agent.py"
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIResponsesModel
agent = Agent(
model=OpenAIResponsesModel("gpt-4.1-mini"),
system_prompt=SYSTEM_PROMPT,
)
```
</Step>
<Step>
### Tell the model when to call it
This is the part that is easy to miss. The tool arrives on every run, but a
model with no instruction about it will answer in prose and never call it.
Name the tool in the system prompt and say what it is for.
```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.
Keep chat responses brief — let the chart do the talking.
"""
```
</Step>
</Steps>