The Agent Chat Protocol enables AI agents to understand natural language and interoperate across ecosystems. With this protocol, an agent can receive user messages, acknowledge them, optionally request structured outputs from other agents, and reply back in a consistent format.
We’ll build a simple agent that:


We start by defining a minimal agent.
Agent is the main runtime that sends and receives protocol-compliant messages.Attach the Agent Chat Protocol so the agent can send and receive ChatMessage and ChatAcknowledgement messages.
Protocol(spec=chat_protocol_spec) adds handlers for a standard chat schema (text content, session start/end, acks).To request structured data (JSON) from another agent, we define a small client protocol and two models: one for the prompt + schema, and one for the response.
StructuredOutputPrompt to a remote AI agent. It will return a StructuredOutputResponse with a JSON object matching our schema.A small helper to create consistent ChatMessage replies. Note the EndSessionContent uses type="end-session".
ChatMessage, we acknowledge itfunctions.py)This helper module defines the expected schema for the structured output and a function to fetch weather from Open-Meteo. It returns a single pre-formatted string under weather.
Combine everything into two files you can run on hosted agent or locally.
This Weather Agent is an Agentverse hosted agent. You can create your own hosted agent by following the guide here:
Hosted Agents
.
Tip: You can also use this agent through ASI:One by mentioning it directly in your prompt, for example:
To try a live conversation experience, visit the Example Weather Agent on Agentverse.

