Skip to main content

Multi-provider AI agents built on pykka.

Project description

actor-ai

Multi-provider AI agents built on pykka.

actor-ai extends pykka's actor framework so each actor can process natural-language instructions, call tools, maintain conversation sessions, remember facts, track token spend, and monitor traffic — all with a clean, provider-agnostic API.

Installation

pip install actor-ai          # or: uv add actor-ai

Requires Python ≥ 3.14 and one (or more) provider API keys.

Quick start

from actor_ai import AIActor, Claude

class Assistant(AIActor):
    system_prompt = "You are a helpful assistant."
    provider = Claude()          # requires ANTHROPIC_API_KEY

ref = Assistant.start()
reply = ref.proxy().instruct("What is the capital of France?").get()
print(reply)   # → "The capital of France is Paris."
ref.stop()

Providers

Class Backend Environment variable
Claude Anthropic ANTHROPIC_API_KEY
GPT OpenAI OPENAI_API_KEY
Gemini Google AI (OpenAI-compat) GOOGLE_API_KEY
Mistral Mistral AI MISTRAL_API_KEY
DeepSeek DeepSeek DEEPSEEK_API_KEY
Copilot GitHub Copilot (OpenAI-compat) GITHUB_TOKEN
LiteLLM Any (100+ models) depends on model

Copilot routes requests through GitHub Copilot's OpenAI-compatible endpoint and supports multiple underlying models from a single token:

from actor_ai import AIActor, Copilot

class Assistant(AIActor):
    system_prompt = "You are a helpful coding assistant."
    provider = Copilot()                    # gpt-4o (default)
    provider = Copilot("claude-sonnet-4-5") # Claude via Copilot
    provider = Copilot("gemini-2.0-flash")  # Gemini via Copilot

# See all valid model strings at runtime
print(Copilot.MODELS)

Valid models: gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini, claude-sonnet-4-5, gemini-2.0-flash. Passing any other string raises ValueError immediately at construction time.

The token is resolved in order: api_key argument → GITHUB_TOKEN env var → gh auth token CLI (no env var needed when the GitHub CLI is authenticated).

Key features

  • Multi-turn sessions — rolling conversation history, configurable window (max_history)
  • Long-term memoryremember(key, value) / forget(key) facts injected into every system prompt
  • Tool calling — decorate methods with @tool to expose them to the LLM
  • Chorus — orchestrate groups of agents (broadcast, pipeline)
  • Accounting — track token usage and cost per actor, model, and session (Ledger, Rates)
  • Monitoring — forward per-call metadata to LiteLLM callbacks (Langfuse, Helicone, custom)

Examples

The examples/ directory contains ten self-contained, runnable scripts.
Each example uses a fake scripted provider so no API key is required to run them.

examples/
  01_hello_world.py    — One-turn interaction
  02_session.py        — Session history, max_history, clear_session
  03_memory.py         — remember() / forget()
  04_tools.py          — @tool decorator and tool calling
  05_providers.py      — All six provider configurations
  06_chorus.py         — Chorus: instruct, broadcast, pipeline
  07_accounting.py     — Ledger and Rates
  08_monitoring.py     — LiteLLM monitoring
  09_messages.py       — Instruct / Remember / Forget message objects
  10_advanced.py       — Full pipeline combining all features

Run any example:

uv run python examples/01_hello_world.py

User Manual

See MANUAL.md for the complete reference.

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

actor_ai-0.1.2.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

actor_ai-0.1.2-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file actor_ai-0.1.2.tar.gz.

File metadata

  • Download URL: actor_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for actor_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c9f5491c407c4978d5bff130bab256ba52c18e190e986d80c3acd263f6d62481
MD5 35ae7780e4832fd43be540d3cf54701b
BLAKE2b-256 15258ef55f66f5b049cadee569219fc8ca1daa81f793a31c89990732cd893e74

See more details on using hashes here.

File details

Details for the file actor_ai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: actor_ai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for actor_ai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b8ad8831984784d1b838a2166b89a82e3252c8e2efbdbb0a1cec90ab9630ac12
MD5 d4850ba4519ba67098cb0347fb29c20a
BLAKE2b-256 a98717f1d47020058bb7b279ed72fce5bfc2e10874892c8c87c6a7625a3c04e5

See more details on using hashes here.

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