English
What problem does this solve?
Part 1's server answered every question the same fixed way — useful for learning the protocol, useless for a real product. The moment a business wants an agent to actually reason about a request, the server side needs a language model behind it, and the transport needs to be sturdy enough for production traffic.
This is the step most teams underestimate: swapping in an LLM is easy, but doing it without losing conversation context between calls is the part that actually matters. This walkthrough continues studying the open-source theailanguage/a2a_samples reference implementation.
How the mechanism works
Google ADK splits the agent into two pieces. LlmAgent is the "soul" — the model choice and the system instruction. Runner is the "body" — it manages sessions and memory, so a follow-up question can reference what was asked before instead of starting from zero every time.
On the transport side, the plain REST calls from part 1 are replaced with JSON-RPC 2.0, a stricter contract that's common in service-to-service and multi-agent architectures. When the server receives a request, it hands the message to the Runner, which runs the LLM asynchronously and marks the task completed once Gemini responds.
Trade-offs and alternatives
The benefit is a genuinely reasoning agent that remembers context across a session, not a stateless echo. The trade-off is added latency and cost — every call now involves a real model inference, and the session store has to be managed somewhere (in-memory here, which does not survive a server restart).
An alternative some teams try first is keeping the client responsible for re-sending the full conversation history on every call. That avoids server-side session state, but it pushes complexity and token cost onto every caller instead of solving it once, centrally.
Conclusion
The pattern worth remembering: separate "what the model should do" (the LlmAgent) from "how state is kept between calls" (the Runner). That separation is what turns a one-shot completion API into something that behaves like a conversation.