Order desk agents

Run the order desk backend with Google ADK, LangGraph or Pydantic AI. Use scripted responses, Ollama or Gemini.

The order desk has a reference backend for each of these frameworks.

Each agent fills a B2B order from an e-mail. Its backend tools look up the customer and order history. The screen's data arrives in each run's AG-UI context, and its listed methods arrive as tools. The agent changes the order by calling those methods in the app.

The backend guide explains the contract and adapter configuration. The three implementations share their customer data, backend tools, instructions, scripted responses and contract tests in order-desk.

Install uv. Run the commands below in a backend's folder, such as example/agents/adk.

Run

For scripted responses without a model or API key, run this command.

TANDEM_FAKE_LLM=1 uv run order-agent

For a local model, start Ollama at http://127.0.0.1:11434, download the model and start the backend.

ollama pull qwen3.5:4b
uv run order-agent

The reference agents disable thinking for Ollama.

For Gemini, set GOOGLE_API_KEY in the backend's environment, then run this command.

TANDEM_PROVIDER=gemini uv run order-agent

The server listens on 127.0.0.1:8000 and accepts AG-UI requests at POST /agent. Any server-side conversation state lives in memory and is lost on restart. Pydantic AI reads the conversation from the app's messages on every run.

Configuration

VariableDefaultMeaning
TANDEM_FAKE_LLMSet to 1 for scripted responses.
TANDEM_PROVIDERollamaollama or gemini.
TANDEM_MODELqwen3.5:4b, gemini-3.8-flashThe provider's model name.
TANDEM_OLLAMA_URLhttp://127.0.0.1:11434Where Ollama listens.
TANDEM_TODAY2026-10-16The date the demo treats as today. In the sample e-mail, "by Friday" means 2026-10-23.
TANDEM_HOST127.0.0.1The bind address. Use 0.0.0.0 to connect a physical device over the local network.
TANDEM_PORT8000The port to listen on.
GOOGLE_API_KEYThe Gemini API key.

The backends have no sign-in. With TANDEM_HOST=0.0.0.0, anyone on your network can use the agent. If it uses Gemini, their requests spend your model credits. Use the default bind address when connecting from a simulator or emulator. The connection instructions give the URL for each platform.

The script

This scenario uses the backend's scripted model and the order desk's sample e-mail.

#YouThe agentThe screen
1Tap the sample e-mailfind_customer, get_order_historyNothing yet
2set_customer, two times search_catalogThe customer card fills in
3"I assumed the ProView 27Q, as in your September order ORD-0987." set_quantity for both products, set_deliveryLines, prices, address and date appear
4"40 HDMI cables and 12 ProView 27Q monitors, delivered on 23 Oct. Total 14 349.44 PLN. Shall I place it?"
5Tap + on the monitors until 15, type Looks good, place it"You changed the monitors to 15, which unlocks Acme's 15+ tier (17 % off monitors)." place_orderPrices update on each tap. An approval card opens.
6Tap Approve"Order ORD-1042 placed for 23 Oct."The card shows Approved. The order is marked "Placed as ORD-1042" and becomes read-only for the user and agent.

To test invalidation, change the delivery date instead of approving in step 6. The old request becomes invalid. A second after your last edit, the example wakes the agent. The scripted backend requests approval again with the new date. Tap Reject, and it answers "OK, I won't place it."

The example implements this wake-up with session.wake(). Tandem does not start a new run automatically when an edit invalidates a pending request.

Checks

uv sync --locked
uv run ruff check . ../order-desk
uv run ruff format --check . ../order-desk
uv run pytest

In adk, both ruff commands also take ../adk-streaming.

All three backends run the shared AG-UI contract tests. They use scripted responses over HTTP and a test client that maintains the thread as Tandem does. ADK and Pydantic AI also have adapter-specific tests in their tests folders.

CI runs these checks for each backend. Tests with Ollama or Gemini are manual.