Metadata-Version: 2.4
Name: agent-patterns-py
Version: 0.1.0
Summary: Production-ready boilerplate for common agentic AI patterns in Python
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: litellm>=1.0
Requires-Dist: python-dotenv>=1.0
Provides-Extra: dev
Requires-Dist: ipykernel>=6.0; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Description-Content-Type: text/markdown

# agent-patterns

A Python framework for building production-ready AI agents using the GAME pattern (Goals, Actions, Memory, Environment).

---

## Install

```bash
git clone https://github.com/your-username/agent-patterns.git
cd agent-patterns
uv sync
cp .env.example .env  # add your API keys
```

---

## Quick start

```python
import os
from agent_patterns import (
    Agent, Goal,
    PythonEnvironment,
    AgentFunctionCallingActionLanguage,
    PythonActionRegistry,
    register_tool,
    make_generate_response,
)

@register_tool(tags=["files"])
def list_files() -> list:
    """List files in the current directory."""
    return os.listdir(".")

@register_tool(tags=["files"])
def read_file(name: str) -> str:
    """Read a file and return its contents."""
    with open(name) as f:
        return f.read()

@register_tool(tags=["system"], terminal=True)
def terminate(message: str) -> str:
    """End the session with a final message."""
    return message

agent = Agent(
    goals=[
        Goal(1, "Explore", "List and read files in the current directory."),
        Goal(2, "Terminate", "Call terminate with a summary when done."),
    ],
    agent_language=AgentFunctionCallingActionLanguage(),
    action_registry=PythonActionRegistry(tags=["files", "system"]),
    generate_response=make_generate_response("openai/gpt-4o"),
    environment=PythonEnvironment(),
)

memory = agent.run("What Python files are here and what do they do?")
```

---

## Docs

- [Switching models](docs/models.md)
- [Agent language strategies](docs/agent-language.md)
- [Capabilities](docs/capabilities.md)
- [Dependency injection](docs/dependency-injection.md)
- [Multi-agent](docs/multi-agent.md)
- [Safety patterns](docs/safety.md)

---

## License

MIT
