Published: 2026-06-20
Build 3 Production AI Agents in Python with AgentSpan: Memory, RAG, and Orchestration
Tech With Tim builds three Python agents on the open-source AgentSpan framework — a conversational agent with memory, a RAG agent over a company database, and a multi-agent orchestrator — each written line by line. The focus is what makes an agent production-ready: durability across crashes, retries, human-in-the-loop, observability, long-running tasks and scale, all handled by a local AgentSpan server.
Source video
"Build 3 PRODUCTION AI Agents in Python - Full Course (Agentspan)" by Tech With Tim — Watch on YouTube →
Key Takeaways
- Production agents need seven things: durability (recover without restarting), retries, human-in-the-loop, observability, long-running task support, scale and testing.
- AgentSpan splits the system into a worker (your code) and a server (provided, open-source) that tracks state, history and orchestration — so a crashed run reconnects and resumes instead of losing work.
- API keys live on the server, not in worker code, which is more secure; you export the provider key (OpenAI, Anthropic, Gemini, etc.) before starting the server.
- Tools are plain Python functions wrapped with an @tool decorator; the function name becomes the tool name and the docstring becomes its description the model reads.
- Adding ConversationMemory(max_messages=50) gives the agent recall across turns; the server dashboard shows every tool call, input, output and stop reason in real time.
Commands & Code Mentioned
pip install agent-span # or: uv add agent-span
uv run agentspan doctor # check the install (Java 21, disk, API key, server jar)
uv run agentspan server start
export OPENAI_API_KEY=<your key> # set before starting the server
uv add python-dotenv pydantic firecrawl-py
@tool # decorator that turns a Python function into an agent tool
uv run agents/agent1.py





