Skip to main content

Python SDK for the Argentor AI agent framework

Project description

Argentor Python SDK

Pure-Python client for the Argentor AI agent framework.

Install

pip install -e python/

Requires Python 3.9+ and httpx.

Quick start

from argentor import Agent

agent = Agent(api_key="sk-ant-...", model="claude-3-5-sonnet-20241022")
response = agent.run("What is the capital of Argentina?")
print(response)

Set ANTHROPIC_API_KEY in your environment to omit api_key:

import os
os.environ["ANTHROPIC_API_KEY"] = "sk-ant-..."
agent = Agent()

Agent with skills (tool use)

def get_weather(city: str) -> str:
    return f"Sunny in {city}, 22C"

agent = Agent(api_key="sk-ant-...")
agent.add_skill(
    name="get_weather",
    description="Get the current weather for a city",
    fn=get_weather,
    parameters={
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"],
    },
)

response = agent.run("What is the weather in Buenos Aires?")
print(response)

Async API

import asyncio
from argentor import Agent

async def main():
    agent = Agent(api_key="sk-ant-...")
    response = await agent.run_async("Explain quantum entanglement in one sentence.")
    print(response)

asyncio.run(main())

Session management

agent = Agent(api_key="sk-ant-...")
agent.run("My name is Federico.")
response = agent.run("What is my name?")  # maintains context
print(response)  # "Your name is Federico."

# Reset session
agent.reset_session()

Classes

Class Description
Agent Main agent class with run() / run_async()
Session Conversation history tracking
Message Single message (role + content)
Skill A callable tool the agent can invoke
SkillRegistry Registry for discovering and invoking skills

Rust extension (optional)

For the compiled Rust extension (PyO3/maturin, faster execution):

pip install maturin
cd crates/argentor-python
maturin develop

The crates/argentor-python/ extension exposes Session, SkillRegistry, GuardrailEngine, Calculator, HashTool, and JsonQuery as compiled Rust classes.

License

AGPL-3.0-only

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

argentor-1.3.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

argentor-1.3.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file argentor-1.3.0.tar.gz.

File metadata

  • Download URL: argentor-1.3.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for argentor-1.3.0.tar.gz
Algorithm Hash digest
SHA256 3a75029e64dbe5dc6924ffad78c495bfebb5a53036d3d957d0b10a94dd710f4e
MD5 a0a4afdfbf7f87a51c5fe5dafee019a8
BLAKE2b-256 531665d57519c1438b79e2b95dcef1a6ec1e159963e2246b4644e56d2ae1f1a0

See more details on using hashes here.

File details

Details for the file argentor-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: argentor-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for argentor-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fde19a8a050bfc101710d8cb07e8ef57269cfb0d52dd02e140dce44bf1121e0f
MD5 30c2bbfb38fcd8498f3c54b97ee515f7
BLAKE2b-256 a4a86a71502037d4c748086e1e882665ef74030e48a33d3d540bce88ede32ec4

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