Python SDK Overview
Full API parity with the TypeScript core — snake_case, Pydantic validation, async/await.
Installation
pip install agentforgeAPI Parity
The Python SDK mirrors the TypeScript API with Python conventions:
| TypeScript | Python |
|---|---|
camelCase | snake_case |
Zod schemas | Pydantic models |
Promise<T> | async/await |
AsyncGenerator | async for |
Quick Example
import { defineAgent, defineTool, createLLM } from '@ahzan-agentforge/core';
import { z } from 'zod';
const tool = defineTool({
name: 'greet',
description: 'Greet someone',
input: z.object({ name: z.string() }),
output: z.object({ message: z.string() }),
execute: async ({ name }) => ({ message: `Hello, ${name}!` }),
});
const agent = defineAgent({
name: 'greeter',
description: 'Greets people',
tools: [tool],
llm: createLLM({ provider: 'anthropic', model: 'claude-sonnet-4-20250514' }),
systemPrompt: 'You greet people warmly.',
});from agentforge import define_agent, define_tool, create_llm
from pydantic import BaseModel
class GreetInput(BaseModel):
name: str
class GreetOutput(BaseModel):
message: str
tool = define_tool(
name="greet",
description="Greet someone",
input=GreetInput,
output=GreetOutput,
execute=lambda inp: GreetOutput(message=f"Hello, {inp.name}!"),
)
agent = define_agent(
name="greeter",
description="Greets people",
tools=[tool],
llm=create_llm(provider="anthropic", model="claude-sonnet-4-20250514"),
system_prompt="You greet people warmly.",
)What's Included
The Python SDK includes everything from the TypeScript core:
- Agent, define_agent, define_tool, create_llm
- All state stores, memory stores, and testing utilities
- Budget governor, autonomy policy, rollback
- Multi-agent coordination (Coordinator, pipeline, parallel, supervisor, debate)
- Error types, tracing, and observability
Next Steps
- Quickstart — Python-specific setup
- API Parity — complete mapping table
- Differences — Python-specific differences