Catalog PyPI
PACKAGE EXPLORERView in registry

agent-patterns-py

PyPI

Production-ready boilerplate for common agentic AI patterns in Python

Versions collected1
Direct dependencies7From release 0.2.0
Last observed20 Oct, 22:51 UTC

README

Version 0.2.0 documentation

agent-patterns

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


Install

pip install agent-patterns-py

Or clone to run the examples:

git clone https://github.com/abdul-moiz-cowlar/agent-patterns.git
cd agent-patterns
uv sync
cp .env.example .env  # add your API keys

Quick start

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


License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

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

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.011 Apr 20267

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:51 UTC

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

Record identity

package:0ec81b159a55a42f8f1476ca256d944504eeabdfb1a1c3b36c479bdbbbbe4676