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.4.0.tar.gz (8.8 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.4.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for argentor-1.4.0.tar.gz
Algorithm Hash digest
SHA256 57bd89adbd792df97da4a0208dae466298ca91e3db4da1318ad70794ed2a63a5
MD5 271dcf16d1e126ac6de33b7726b19887
BLAKE2b-256 5ca12db8bd28f3b4e6360f2a1ddd3be8c9e3a61e0cb98f2a7bdbfe35fcf606ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: argentor-1.4.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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b78c624fd7e6446d3a832a796ce551a15d921cfc4e80bfa21a16fb49aeb22ae
MD5 5cfb5840439746c45e10b973a8244c4c
BLAKE2b-256 907187e8a1d5e6158f0fcd176e494ab2b66ce1d3b5fb3a63ef25a09adb3b5522

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