Skip to main content

Running as a standalone server

Turn Distri into a headless service that exposes HTTP and SSE APIs and is A2A-compatible.

1. Define your agent

---
name = "maps_agent"
description = "Operate Google Maps tools to execute user instructions"
max_iterations = 3

[tools]
external = ["*"]

[model_settings]
model = "gpt-4.1-mini"
temperature = 0.7
max_tokens = 500
---

# ROLE
You are a decisive Google Maps agent. Follow user instructions directly and execute with tools. Be brief and action-first.

# CAPABILITIES
- set_map_center: Set map center to latitude, longitude with optional zoom (1–20).
- add_marker: Place a titled marker at latitude, longitude; optional description.
- get_directions: Retrieve route summary between origin and destination with optional travel_mode (DRIVING, WALKING, BICYCLING, TRANSIT).
- search_places: Find places near latitude, longitude within radius meters (default 5000).
- clear_map: Remove all markers and directions.

2. Run the server

distri serve --project .distri

3. Call the API

List agents and fetch an agent card (A2A):

curl http://localhost:8787/agents

curl http://localhost:8787/agents/maps_agent/.well-known/agent.json

Send a message via A2A JSON-RPC (non-streaming):

curl -X POST http://localhost:8787/agents/maps_agent \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "message/send",
"params": {
"message": {
"kind": "message",
"message_id": "m1",
"role": "user",
"parts": [
{"kind": "text", "text": "Suggest a lunch spot near Clarke Quay"}
]
}
}
}'

Stream responses via Server-Sent Events (SSE):

curl -N -X POST http://localhost:8787/agents/maps_agent \
-H 'Content-Type: application/json' \
-H 'Accept: text/event-stream' \
-d '{
"jsonrpc": "2.0",
"id": "2",
"method": "message/stream",
"params": {
"message": {
"kind": "message",
"message_id": "m2",
"role": "user",
"parts": [
{"kind": "text", "text": "Plot a walking tour around Chinatown"}
]
}
}
}'

Additional useful endpoints:

# Threads
curl "http://localhost:8787/threads?limit=20"
curl http://localhost:8787/threads/{thread_id}
curl -X PUT http://localhost:8787/threads/{thread_id} -H 'Content-Type: application/json' -d '{"title":"My thread"}'
curl -X DELETE http://localhost:8787/threads/{thread_id}
curl http://localhost:8787/threads/{thread_id}/messages

# Tasks
curl "http://localhost:8787/tasks?thread_id={thread_id}&limit=50"

# Workflows
curl http://localhost:8787/workflows
curl http://localhost:8787/workflows/{workflow_id}

# Agent DAG and schema
curl http://localhost:8787/agents/maps_agent/dag
curl http://localhost:8787/schema/agent

# Webhook trigger
curl -X POST http://localhost:8787/webhook/agent \
-H 'Content-Type: application/json' \
-d '{"agent_name":"maps_agent","data":{"task":"Find coffee near Raffles Place"}}'

# Text-to-Speech / Speech-to-Text
curl http://localhost:8787/tts/voices