Skip to main content

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

Release files for agent-patterns-py 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-patterns-py 0.2.0
File Size Uploaded
agent_patterns_py-0.2.0.tar.gz 193.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-patterns-py 0.2.0
File Interpreter ABI Platform
agent_patterns_py-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 227.2 kB

Release files / agent_patterns_py-0.2.0.tar.gz

Download URL agent_patterns_py-0.2.0.tar.gz
Size 193.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4bdee1419f8d0912a7f103ba011999d6857144715a4c3bc2ebbbb93d91a75cd1
BLAKE2b-256 checksum
How to use checksums
647cac7e86c3683e7ac1aee0580cb994878ca0034cd2beb85f17b5931e480e84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 11, 2026.

Transparency log

Release files / agent_patterns_py-0.2.0-py3-none-any.whl

Download URL agent_patterns_py-0.2.0-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87a1cbe1698bead2ee95896631483ebd779f32b28fa84d248891eeba3593ed62
BLAKE2b-256 checksum
How to use checksums
e45cbba2f5837d98134f46f22fcf49d657d242e15e29da7f6aac3c2d58f3929c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page