Catalog PyPI
Back to packageRELEASE DETAILS

0.1.1

PyPI

ahzan-agentforge

Production-grade AI agent framework — the Next.js for AI agents

agentaianthropicframeworkllmopenai
Published13 Mar 2026
Direct dependencies9
Transitive dependenciesNot calculated

README

Version 0.1.1 documentation

ahzan-agentforge

Production-grade AI agent framework — the Next.js for AI agents. Python SDK.

AgentForge owns the agent loop — LLM calls, tool execution, state checkpointing, crash recovery, cost governance, rollback, and full run tracing. You write tools and prompts. Everything else is handled.

PyPI License: MIT

Also available as a TypeScript package: @ahzan-agentforge/core

Install

pip install ahzan-agentforge

With LLM providers:

pip install ahzan-agentforge[anthropic]   # Anthropic Claude
pip install ahzan-agentforge[openai]      # OpenAI GPT
pip install ahzan-agentforge[all]         # All providers + Redis

Quick Start

import asyncio
from agentforge import define_agent, define_tool, create_llm
from pydantic import BaseModel

class OrderInput(BaseModel):
    order_id: str

class OrderOutput(BaseModel):
    id: str
    status: str
    total: float

get_order = define_tool(
    name="get_order",
    description="Fetch order details by ID",
    input_schema=OrderInput,
    output_schema=OrderOutput,
    execute=lambda inp: OrderOutput(id=inp.order_id, status="shipped", total=49.99),
)

agent = define_agent(
    name="support-agent",
    tools=[get_order],
    llm=create_llm(provider="openai", model="gpt-4o"),
    max_steps=15,
    system_prompt="You are a customer support agent. Look up orders and help customers.",
)

async def main():
    result = await agent.run(task="Order #4521 arrived damaged")
    print(result.status)   # 'completed'
    print(result.output)

asyncio.run(main())

Features

  • Execution engine with checkpointing and crash recovery
  • Pydantic schema validation on tool inputs and outputs
  • LLM providers: Anthropic Claude, OpenAI GPT, Ollama (local)
  • Token-level streaming via agent.stream()
  • State stores: in-memory (dev) and Redis (production)
  • Long-term memory: in-memory and PgVector with embedding retrieval
  • Budget governor with token/cost limits and model pricing
  • Autonomy policy with per-tool allow/deny/escalate rules
  • Rollback with compensating actions
  • Multi-agent coordination: pipeline, parallel, supervisor, debate patterns
  • OpenTelemetry observability — every decision traced
  • MockLLM and TestHarness for testing without API calls

LLM Providers

from agentforge import create_llm

llm = create_llm(provider="anthropic", model="claude-sonnet-4-20250514")
llm = create_llm(provider="openai", model="gpt-4o")
llm = create_llm(provider="ollama", model="llama3.1")  # local, zero cost

Streaming

async for event in agent.stream(task="Help customer"):
    if event.type == "llm_token":
        print(event.content, end="", flush=True)
    elif event.type == "tool_start":
        print(f"\nCalling {event.tool_name}...")
    elif event.type == "done":
        print(f"\nResult: {event.result.output}")

Multi-Agent Coordination

from agentforge import pipeline, parallel, supervisor, debate

result = await pipeline([researcher, writer, editor], task="Write a report")
result = await supervisor(manager, {"researcher": researcher, "writer": writer}, task="Complete project")
result = await parallel([agent1, agent2], task="Analyze data", merge_fn=merge_results)
result = await debate([optimist, pessimist], task="Evaluate proposal", judge=judge)

Testing

from agentforge import create_mock_llm, create_test_harness

harness = create_test_harness(
    agent=my_agent_config,
    llm=create_mock_llm(responses=[
        {"tool_calls": [{"name": "get_order", "input": {"order_id": "4521"}}]},
        {"text": "Order found and ticket created."},
    ]),
)

result = await harness.run(task="Handle order issue")
assert result.status == "completed"
assert len(result.tool_calls("get_order")) == 1

API Parity with TypeScript

TypeScriptPython
defineAgent()define_agent()
defineTool()define_tool()
createLLM()create_llm()
createMockLLM()create_mock_llm()
createTestHarness()create_test_harness()
agent.run()agent.run()
agent.stream()agent.stream()
Zod schemasPydantic models
camelCasesnake_case

Requirements

  • Python >= 3.10
  • Redis (optional, for persistent state)
  • PostgreSQL + pgvector (optional, for long-term memory)

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 12

Native requirements
9 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
nanoid
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
nanoid>=2.0.0runtime
pydantic
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pydantic>=2.0runtime
anthropic
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
anthropic>=0.30.0; extra == "all"runtime
openai
Environment
{
  "extras": "",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
openai>=1.30.0; extra == "all"runtime
redis
Environment
{
  "extras": "hiredis",
  "marker": "extra == \"all\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
redis[hiredis]>=5.0.0; extra == "all"runtime
anthropic
Environment
{
  "extras": "",
  "marker": "extra == \"anthropic\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
anthropic>=0.30.0; extra == "anthropic"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
mypy>=1.10; extra == "dev"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.23; extra == "dev"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest>=8.0; extra == "dev"runtime
ruff
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
ruff>=0.4; extra == "dev"runtime
openai
Environment
{
  "extras": "",
  "marker": "extra == \"openai\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
openai>=1.30.0; extra == "openai"runtime
redis
Environment
{
  "extras": "hiredis",
  "marker": "extra == \"redis\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
redis[hiredis]>=5.0.0; extra == "redis"runtime

Distribution files

2 collected
ahzan_agentforge-0.1.1-py3-none-any.whl

bdist_wheel · 55.88 KB · Python py3

Source file
ahzan_agentforge-0.1.1.tar.gz

sdist · 53.3 KB · Python source

Source file

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:44 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:ba8d35ed8e3a67b185fbbef23f821857b5619146779d48fa4304e0e4e16a4ce6

Other collected versions

View all collected versions →