Agent quickstart¶
This quickstart builds an A2A agent in Rust and calls it. The agent, Greeter, greets the name it is sent. It does two things that most real agents do as well:
- It streams its answer: the greeting is sent in pieces, as it is produced.
- It asks for input when it needs it: told only
hello, it replies "Who should I greet?" and waits for the answer.
The steps follow the files in the repository:
- The agent card describes the agent to clients.
- The executor holds the agent's logic.
- Start the server serves the agent over JSON-RPC and REST.
- Call the agent with
curl. - Streaming and multi-turn shows the streamed answer and a conversation over two messages.
- Next steps.
Prerequisites¶
- Rust 1.89 or later, with
cargo. The locked dependencies need it, although the workspace declares 1.85. git,curlandjq.
Get the code¶
The agent is in the examples crate of the repository:
| File | What it holds |
|---|---|
examples/src/quickstart/agent.rs |
The agent card and the executor. |
examples/src/quickstart/server.rs |
The server that serves the agent. |
Check that it builds:
The first build compiles the dependencies, so it takes a while.