The same agent, written five ways
Every agent needs a model, instructions, and an input and output contract; tools, memory, and a coordination flow are optional; guardrails and evaluations are what production adds. A framework moves each of those decisions into code, configuration, or Markdown rather than removing it.
Map an agent from design to implementation
Most agent systems make the same core decisions. Frameworks differ in how those decisions are expressed and which runtime features they provide.
Python · You write Python. Pure Python with types. You define the agent and its tools as typed Python functions.
from pydantic_ai import Agent, RunContext
from pydantic import BaseModel
class Deps(BaseModel): # ← inputs (typed)
user_goal: str
agent = Agent(
"openai:gpt-4o", # ← model & provider
deps_type=Deps,
system_prompt="You are…", # ← system prompt
)
@agent.tool # ← tools: YOU WRITE PYTHON
def read_context(ctx: RunContext[Deps], q: str) -> str:
return load_context(q) # your Python here
result = agent.run_sync("…", deps=Deps(user_goal="…"))The model that interprets the request and produces the next response or action.
Goes in A model identifier, provider, and generation settings.
The role, authority, constraints, and completion criteria.
Goes in Plain-language instructions that state what the agent may do and when the job is complete.
Callable functions or loadable instructions that let the model act beyond text generation.
Goes in A distinct name, input schema, output schema, permissions, and error behavior for each tool.
The data contract the agent receives and returns.
Goes in Named and typed inputs and outputs, plus required evidence or error states.
Working, session, or persistent information that can be recalled later.
Goes in Memory scope, retention rules, storage, retrieval policy, and user controls.
Controls that bound authority and require approval for sensitive effects.
Goes in A permission tier per tool, denied actions, validation gates, and human approval points.
The sequence or graph that connects model calls, tools, agents, and decisions.
Goes in Nodes, transitions, stop conditions, retry limits, and state passed between steps.
Repeatable cases that measure whether the system meets its contract.
Goes in Inputs, expected outputs or scoring rules, thresholds, and regression cases.