ABZ AgentABZ AgentDocs← Site
Docs/Core Concepts/Agents

Agents

The core building block — name, instructions, model, tools, and memory.

An Agent is the main building block of ABZ Agent SDK. It processes user input, follows the instructions you give it, and generates a response using the model you choose.

Creating one takes only a few lines of code.

Create an Agent#

agent.py
from abzagent import Agent

agent = Agent(
    name="ABZ Assistant",
    instructions="You are a helpful AI assistant.",
    model="gemini-2.5-flash"
)

Run an Agent#

Use the run() method to send a prompt to your agent.

Python
result = agent.run("Explain what an AI agent is.")

print(result.content)

The model's response is available through result.content.

How It Works#

  • Your instructions are sent to the model as its system prompt, shaping how it behaves for every request.
  • run() sends your prompt to the model configured in model and waits for a response.
  • If the agent has tools, the model can call them before producing a final answer.
  • The result is wrapped in a response object — result.content for text, or result.parsed when using Structured Output.

Agent Parameters#

When creating an agent, you can configure the following options.

ParameterDescription
nameName of the agent.
instructionsDefines how the agent should behave.
modelThe AI model used by the agent.
toolsRegister function tools or built-in tools.
memoryEnable conversation memory.
output_typeReturn a validated Pydantic object instead of raw text.
input_guardrailsValidate user input before it reaches the model.
output_guardrailsValidate the model's response before it's returned.
handoffsLet this agent transfer the conversation to a specialist agent.

Extending an Agent#

Every capability below is optional — add what your application needs, when it needs it.

  • Memory — remember previous turns in the conversation.
  • Function Tools — let the agent call your own Python functions.
  • Built-in Tools — ready-to-use tools included with the SDK.
  • Structured Output — return validated Python objects instead of text.
  • Guardrails — control what the agent accepts and returns.
  • Handoffs — transfer a conversation to a specialist agent.

Example#

math_assistant.py
from abzagent import Agent

agent = Agent(
    name="Math Assistant",
    instructions="Answer math questions clearly.",
    model="gemini-2.5-flash"
)

result = agent.run("What is 15 × 12?")

print(result.content)

Next Step#

Continue to Memory to learn how your agent can remember previous conversations.

← Previous
Quickstart
Next →
Memory