Observed since 20 Oct, 21:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Lightweight framework for building agentic AI backends with FastAPI

AgentAPI is an open-source Python framework for building agentic AI backends with a clean developer experience: minimal setup, provider abstraction, tool calling, memory, and streaming-first APIs.
It is designed for teams that want FastAPI-style simplicity for LLM agents, without heavy orchestration overhead.
Agent interface across providers.Agent class with memory and tool execution loop.openai, gemini, and openrouter.@app.chat..env.Install from PyPI:
pip install agentapi-core
Install in editable mode while developing:
pip install -e .
Create main.py:
from agentapi import AgentApp, Agent
app = AgentApp()
agent = Agent(
system_prompt="You are a helpful assistant",
provider="openai",
)
@app.chat("/chat")
async def chat(message: str):
return await agent.run(message)
@app.chat("/stream")
async def stream_chat(message: str):
return agent.stream(message)
Run it:
uvicorn main:app --reload
Open docs:
http://127.0.0.1:8000/docshttp://127.0.0.1:8000/redocCreate .env:
OPENAI_API_KEY=
GEMINI_API_KEY=
OPENROUTER_API_KEY=
DEFAULT_PROVIDER=openai
Supported provider names:
openaigeminiopenrouterDefine tools with plain Python:
from agentapi import tool
@tool
def get_weather(city: str) -> str:
"""Get weather for a city."""
return f"Weather in {city}: sunny"
Attach tools to an agent:
agent = Agent(
system_prompt="You are a weather assistant",
provider="openai",
tools=[get_weather],
)
Tool schemas are generated from function signatures and mapped to provider-specific tool formats internally.
@app.chat auto-switches to SSE (text/event-stream) when your handler returns an async iterator.
Example:
@app.chat("/stream")
async def stream_chat(message: str):
return agent.stream(message)
Create a new project scaffold:
agentapi new myproject
Interactive setup (asks for project name and provider):
agentapi new
Run app via helper:
agentapi run --app main:app --reload
OpenAICompatibleProvider is an internal helper for OpenAI-compatible APIs. AgentAPI is not locked to it.
You can customize providers in two ways:
provider=<BaseProvider instance>from agentapi import Agent, BaseProvider
from agentapi.providers.base import ProviderResponse
class MyProvider(BaseProvider):
async def chat(self, messages, *, tools=None, tool_calling=None):
return ProviderResponse(content="hello", tool_calls=[], raw_message={})
async def stream(self, messages, *, tools=None, tool_calling=None):
yield "hello"
Agent.register_provider(
"myprovider",
lambda agent, settings, model: MyProvider(),
)
agent = Agent(system_prompt="You are helpful", provider="myprovider")
AgentAPI converts common runtime issues into clear API-level errors:
agentapi/
agent/
agent.py
memory.py
tools.py
assets/
agentapi-logo.png
agentapi-favicon.png
config/
settings.py
core/
app.py
providers/
base.py
gemini.py
openai_compatible.py
openai.py
openrouter.py
examples/
main.py
Current phase: MVP
Implemented:
Contributions are welcome. See CONTRIBUTING.md for setup and PR workflow.
This repository is configured to publish on GitHub Release.
version in pyproject.toml.Required one-time setup:
agentapi-core..github/workflows/publish.yml.Use these exact values when adding publishers.
TestPyPI pending publisher:
agentapi-coreprajwalsuryawanshiagentapipublish-testpypi.ymltestpypiPyPI trusted publisher (after project exists):
agentapi-coreprajwalsuryawanshiagentapipublish.ymlpypiNote: package names on PyPI are normalized, so use lowercase agentapi-core.
MIT License. See LICENSE.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 9 Mar 2026 | 4 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 21:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:a1b0eec6fc60814b1cbd76ede3e2d25f02b5ad0f76c48f6108a7e0ee881c7016