Examples: no-framework backends¶
Web apps, workers, scripts, serverless, deploy. Back to the Examples gallery. Files here: 20.
| File | Shows | Install | Run | Docs |
|---|---|---|---|---|
examples/backend_celery.py |
Celery: tasks call tools through run_sync; an approval parks between two tasks. | pip install agent-adapter celery |
import only | Celery |
examples/backend_common.py |
The service layer the backend examples share: tools, one Executor per process, approvals. | pip install agent-adapter |
import only | FastAPI |
examples/backend_django.py |
Django in one file: async views await the service, sync views use run_sync, tools beside it. | pip install "agent-adapter[server]" django |
python examples/backend_django.py (starts a server on :8000) |
Django |
examples/backend_fastapi.py |
FastAPI: one Executor per process, async routes, approvals over HTTP, the tool server mounted. | pip install "agent-adapter[server]" fastapi |
python examples/backend_fastapi.py (starts a server on :8000) |
FastAPI |
examples/backend_flask.py |
Flask: one Executor per process, run_sync in sync views, the tool server under /agent. | pip install "agent-adapter[server-wsgi]" flask |
python examples/backend_flask.py (starts a server on :8000) |
Flask |
examples/backend_loop_runner.py |
A warm sync process (Lambda, Dramatiq, gRPC sync servicer): one loop, clients kept warm. | pip install agent-adapter |
python examples/backend_loop_runner.py |
Runtime |
examples/backend_notebook.py |
Notebooks and apps: Jupyter awaits, Streamlit reruns call run_sync, Gradio handlers await. | pip install agent-adapter |
import only | Notebooks and apps |
examples/backend_other_asgi.py |
Other frameworks: mount the ASGI tool server, or call ToolService from aiohttp and gRPC. | pip install "agent-adapter[server]" aiohttp |
import only | Other web frameworks |
examples/backend_pipeline.py |
Pipelines: build the executor on the worker, then call tools from tasks, UDFs and actors. | pip install agent-adapter |
import only | Data pipelines |
examples/backend_queue.py |
Queues: one handle_envelope for async consumers, sync job runners and Temporal activities. |
pip install agent-adapter |
import only | Queues and consumers |
examples/backend_script.py |
Scripts and batch jobs: argparse, run_sync, one batch through run_many, exit codes. | pip install agent-adapter |
python examples/backend_script.py |
Scripts and batch jobs |
examples/backend_serverless.py |
Serverless: one tool_handler for Lambda; handle_envelope for async function hosts. |
pip install agent-adapter |
import only | Serverless functions |
examples/deploy/app.py |
The container's ASGI app: uvicorn app:app; shared state in Redis when REDIS_URL is set. |
pip install "agent-adapter[server]"; optional: pip install "agent-adapter[redis]" |
import only | Deploy: Docker, Kubernetes and probes |
examples/golden_path/agent.py |
Golden path: the support desk agent: one executor with approvals, budgets, guards and a recorder. | pip install agent-adapter |
import only | Tutorial: the golden path |
examples/golden_path/app.py |
Golden path: the support desk as a FastAPI service. Run: uvicorn golden_path.app:app | pip install agent-adapter fastapi |
import only | Tutorial: the golden path |
examples/golden_path/requesters.py |
Golden path: who asked for each parked call, so a reviewer never approves their own. | pip install agent-adapter |
import only | Tutorial: the golden path |
examples/golden_path/tools.py |
Golden path: the support desk's tools: orders, a confirmed refund, help, memory, tickets. | pip install agent-adapter |
import only | Tutorial: the golden path |
examples/template_celery.py |
Starter Celery tasks: one task runs one tool. Scaffolded by agent-adapter init. |
pip install agent-adapter celery |
python examples/template_celery.py |
CLI |
examples/template_fastapi.py |
Starter FastAPI app: POST /tools/{name} runs one tool. Scaffolded by agent-adapter init. |
pip install agent-adapter fastapi |
import only | CLI |
examples/template_flask.py |
Starter Flask app: POST /tools/agent-adapter init. |
pip install agent-adapter flask |
import only | CLI |