Skip to main content
This tutorial builds the same agent three times — once for each capability layer — so you can stop at whichever level you need. By the end you have a registered CRAFT agent that lists your project’s data connections and is discoverable by other platform services. What you’ll build: A data-assistant agent that:
  1. Responds to prompts using CRAFT’s managed LLM gateway
  2. Calls the CRAFT Assets API to list real data connections
  3. Is registered in the CRAFT agent registry
Time: ~5 min per step. Steps are independent — come back later for the next one. Prerequisites:
Obtain a CRAFT project access token via your deployment’s OIDC token endpoint (client credentials grant) and export the connection settings:
For local dev, run docker-compose up from the solution starter template — it pre-configures OIDC_TOKEN_URL, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET, and the local URLs.

Step 1 — Connect to CRAFT’s LLM gateway

The only difference between a standalone agent and a CRAFT-native agent is where it routes its LLM calls. CRAFT runs a LiteLLM gateway that handles model selection, project billing, and rate limits. All four frameworks reach it through an OpenAI-compatible endpoint. Pick your framework:
agent.py
For production multi-agent patterns with A2A, see the multi-agent patterns guide — it shows how an orchestrator uses ADK to chain a text-to-SQL agent and an insights agent over the A2A protocol.
That’s it. Your agent is running on CRAFT’s managed LLM infrastructure.

Routing to specific backends

The CRAFT gateway uses LiteLLM under the hood, so any model string it recognises works in the model= field — you don’t need to change any client code. Ask your platform team which models are in the project’s allowlist.
Use gemini-3.1-pro-preview-customtools only when extensive custom tool calling is core to your agent. Same intelligence as base gemini-3.1-pro, fine-tuned to prioritize registered custom functions over bash fallbacks. Google’s own guidance: if >50% of requests don’t involve tool calling, stay on gemini-3.5-flash3.5-flash already beats 3.1-pro on agentic benchmarks (MCP Atlas +5.4%) and coding (Terminal-Bench +6%) at 3.6× the speed (source), and the customtools variant degrades quality on non-tool workloads (source). When you do use it: preview SLA, global endpoint only (vertex_location must be global), lower quota than GA — configure a fallback to gemini-3.5-flash or claude-opus-4-8.

Step 2 — Add a CRAFT tool

Tools let your agent take action. The simplest CRAFT tool calls the Assets API to list the data connections registered in your project — real databases and warehouses the platform knows about.
agent.py
Your agent now answers questions using real platform data. Every other CRAFT capability — agents, files, models, artifacts — is one more httpx.get() away.

Step 3 — Register your agent

A registered agent is discoverable by other platform services, the UI, and other agents via the A2A protocol. Registration is one POST to the Assets API.
register.py
The agent_card_url points to a /.well-known/agent-card.json endpoint your service exposes — it describes your agent’s skills so other agents can call it. See the A2A protocol primer for the Agent Card schema, and multi-agent patterns for wiring A2A delegation.
Re-POSTing the same name in a project returns 409 RESOURCE_ALREADY_EXISTS. To update an existing registration, PUT /assets/agents/{resource_uri} and include the current ETag in If-Match:
  • PUT without If-Match returns 428 Precondition Required.
  • PUT with a stale If-Match returns 412 Precondition Failed ("ETag mismatch — resource was modified").
Read the current ETag from the ETag header on a prior GET /assets/agents/{resource_uri} (or use the current_version field from the JSON body — both are equivalent), and feed it back on the next PUT. Either the bare integer (If-Match: 1) or the quoted form (If-Match: "1") is accepted; weak ETags (W/"1") are rejected. Automate the GET → PUT(If-Match) cycle in your deploy pipeline so the registry stays in sync with your running service.

What’s next

Add more tools

Function tools, MCP tools via FastMCPToolset, schema discipline.

Multi-agent patterns

A2A delegation, parallel fan-out, supervisor agents.

A2A protocol primer

Agent Cards, JSON-RPC over SSE, task lifecycle.

Eval harness

Golden traces, Langfuse evaluators, regression suites.