Metadata-Version: 2.4
Name: chatloop
Version: 0.1.0
Summary: A reusable agentic chat library with tool-calling loop, multi-provider LLM support, and MCP integration.
Project-URL: Homepage, https://github.com/deduu/chatloop
Project-URL: Repository, https://github.com/deduu/chatloop
Project-URL: Issues, https://github.com/deduu/chatloop/issues
Author-email: Auditi <hello@auditi.ai>
License-Expression: MIT
License-File: LICENSE
Keywords: agent,anthropic,chat,google,llm,mcp,openai,tool-calling
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: pydantic>=2.0
Provides-Extra: all
Requires-Dist: anthropic>=0.40; extra == 'all'
Requires-Dist: google-genai>=1.0; extra == 'all'
Requires-Dist: mcp>=1.0; extra == 'all'
Requires-Dist: openai>=1.0; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.40; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100; extra == 'fastapi'
Provides-Extra: google
Requires-Dist: google-genai>=1.0; extra == 'google'
Provides-Extra: mcp
Requires-Dist: mcp>=1.0; extra == 'mcp'
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == 'openai'
Description-Content-Type: text/markdown

# chatloop

A reusable agentic chat library with tool-calling loop, multi-provider LLM support, and MCP integration.

## Install

```bash
pip install chatloop[openai]          # OpenAI provider
pip install chatloop[anthropic]       # Anthropic provider
pip install chatloop[google]          # Google Generative AI provider
pip install chatloop[all]             # All providers + MCP
pip install chatloop[fastapi]         # FastAPI integration
```

## Quick Start

```python
import asyncio
from chatloop import ChatLoop, tool

@tool(description="Add two numbers")
async def add(context, a: int, b: int):
    return {"result": a + b}, None

async def main():
    loop = ChatLoop(
        provider="openai",
        model="gpt-4o",
        api_key="sk-...",
        tools=[add],
    )
    response = await loop.ask("What is 2 + 3?")
    print(response.answer)

asyncio.run(main())
```

## Multi-Provider

```python
# OpenAI
loop = ChatLoop(provider="openai", model="gpt-4o", api_key="...")

# Anthropic
loop = ChatLoop(provider="anthropic", model="claude-sonnet-4-5-20250514", api_key="...")

# Google
loop = ChatLoop(provider="google", model="gemini-2.0-flash", api_key="...")
```

## MCP Servers

```python
from chatloop import ChatLoop
from chatloop.mcp import MCPServer

postgres = MCPServer(
    command="npx", args=["-y", "@modelcontextprotocol/server-postgres", DB_URL],
    name="postgres",
)

async with ChatLoop(
    provider="openai", model="gpt-4o", api_key="...",
    mcp_servers=[postgres],
) as loop:
    response = await loop.ask("What tables exist in the database?")
```

## FastAPI Integration

```python
from fastapi import FastAPI
from chatloop import ChatLoop
from chatloop.integrations.fastapi import create_router

app = FastAPI()
loop = ChatLoop(provider="openai", model="gpt-4o", api_key="...", tools=[...])
app.include_router(create_router(loop=loop, prefix="/chat"))
```

## License

MIT
