Skip to main content

OpenAgentFramework — minimal, fast, transparent AI agent framework

Project description

OAF — OpenAgentFramework

Minimal, fast, transparent AI agent framework for Python.

JSON-based tool calling, provider-agnostic (OpenAI + Anthropic), full prompt inspectability.

Install

pip install scope-oaf

Or from source:

pip install /path/to/oaf

Quick Start

import asyncio
from oaf import Agent, ToolRegistry

registry = ToolRegistry()

@registry.register
async def get_weather(city: str) -> str:
    """Get the current weather for a city."""
    return f"Weather in {city}: 72°F, sunny"

agent = Agent(model="gpt-4.1-nano", tools=registry)
response = asyncio.run(agent.message("What's the weather in Tokyo?", role="user"))
print(response.text)

Top-level API

from oaf import Agent, Hooks, Tool, tool, tool_method, BaseToolGroup, ToolRegistry

That's the full autocomplete list. Everything else lives in subpackages.

Subpackages

# LLM client, types, models, errors
from oaf.llmclient import LLMClient, Message, ChatResponse, Models, LLMError

# Context / memory
from oaf.context import BaseContext, ConversationalInMemory

# Prompt builders
from oaf.prompts import BasePromptBuilder, DefaultPromptBuilder

Tool Groups

from oaf import BaseToolGroup, tool_method, ToolRegistry

class MathTools(BaseToolGroup):
    """Mathematical operations."""
    name = "math"

    @tool_method
    async def add(self, a: int, b: int) -> str:
        """Add two numbers."""
        return str(a + b)

registry = ToolRegistry()
registry.register_group(MathTools())

Providers

Set OPENAI_API_KEY and/or ANTHROPIC_API_KEY as environment variables, or pass them directly:

from oaf.llmclient import LLMClient

client = LLMClient(openai_api_key="sk-...", anthropic_api_key="sk-ant-...")

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scope_oaf-0.2.0.tar.gz (47.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scope_oaf-0.2.0-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file scope_oaf-0.2.0.tar.gz.

File metadata

  • Download URL: scope_oaf-0.2.0.tar.gz
  • Upload date:
  • Size: 47.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scope_oaf-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e555b243ae3deb9c4c9973526988e59f3b5dea700780154ab4cc7b391891a8f1
MD5 52a3ad098a7ac19e4adccb5829748115
BLAKE2b-256 17652e29fcda81435468e8b97662fc354d669546a6202da2d2f10746d30d9d2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for scope_oaf-0.2.0.tar.gz:

Publisher: publish.yml on devincii-io/scope-oaf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scope_oaf-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: scope_oaf-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scope_oaf-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9667191db8c8c8a391b51a4db555815c5108a81eba0f7add01a96d8d782429f3
MD5 834eaea400288edf56797ab54259ecd5
BLAKE2b-256 351c7e9dd57fb11f1f74bec050f7fedd9b493da9f6a7f6a7f6f0684f5937e4fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for scope_oaf-0.2.0-py3-none-any.whl:

Publisher: publish.yml on devincii-io/scope-oaf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page