Skip to main content

Official Python SDK for AgentX (https://www.agentx.so/)

Project description

Logo

PyPI version

The official Python SDK for AgentX — build, chat with, and orchestrate AI agents in a few lines of code.


Contents


Why AgentX

  • Simple mental modelAgent → Conversation → Message.
  • Chain-of-thought is built in, no extra plumbing.
  • Bring any LLM — works across major open and closed-source vendors.
  • Batteries included — voice (ASR/TTS), image generation, document/CSV/Excel/OCR, RAG with built-in re-ranking.
  • MCP support — connect any Model Context Protocol server.
  • Multi-agent orchestration — workforces of agents with a designated manager, across LLM vendors.
  • Agent Evaluations — score any agent (LangChain, CrewAI, OpenAI, Anthropic, HTTP, …) with LLM-as-a-judge ratings plus optional cosine and Jaccard similarity metrics.
  • A2A — Each agent can be published with agent-to-agent protocol compatible.

Installation

pip install --upgrade agentx-python

Requires Python 3.9 or newer.


Authentication

Get your API key at app.agentx.so, then either pass it inline or expose it as an environment variable.

# Option A — pass the key inline
from agentx import AgentX
client = AgentX(api_key="your-api-key-here")

# Option B — set AGENTX_API_KEY in your environment, then:
client = AgentX.from_env()

Quick start

from agentx import AgentX

client = AgentX.from_env()

# Pick an existing agent and chat with it
agent = client.list_agents()[0]
conversation = agent.new_conversation()
print(conversation.chat("Hello! What can you help me with?"))

That's it. The remaining sections show the same primitives in more detail.


Working with agents

List agents

agents = client.list_agents()
print(f"You have {len(agents)} agents")

Start a conversation

agent = client.get_agent(id="<agent-id>")

# Either resume an existing conversation…
existing = agent.list_conversations()
last = existing[-1]
for msg in last.list_messages():
    print(msg)

# …or start a fresh one
conversation = agent.new_conversation()

Chat (streaming and non-streaming)

# Blocking — returns the full response once it's ready
response = conversation.chat("What is your name?")
print(response)

# Streaming — yields ChatResponse objects as the model produces them
for chunk in conversation.chat_stream("Hello, what is your name?"):
    if chunk.text:
        print(chunk.text, end="")

Each ChatResponse chunk exposes the agent's text and, where applicable, its cot (chain-of-thought) reasoning, along with any retrieved references and tasks.


Workforce (multi-agent orchestration)

A workforce is a team of agents coordinated by a designated manager agent. Workforces can mix LLM vendors and route work between specialists.

workforces = client.list_workforces()
workforce = workforces[0]

print(f"Workforce: {workforce.name}")
print(f"Manager:   {workforce.manager.name}")
print(f"Agents:    {[a.name for a in workforce.agents]}")

# Chat with the workforce — the manager decides which agent(s) to delegate to
conversation = workforce.new_conversation()
for chunk in workforce.chat_stream(conversation.id, "How can you help me with this project?"):
    if chunk.text:
        print(chunk.text, end="")

Custom agent evaluations

Evaluate any AI agent — LangChain, CrewAI, AutoGen, LlamaIndex, OpenAI, Anthropic, HTTP endpoints, or plain Python — using AgentX as the scoring and reporting backend. Includes optional cosine and Jaccard similarity metrics alongside LLM-graded ratings.

report = (
    client.evaluations
    .run(dataset_id="evds_…", subject={"kind": "custom_agent", "framework": "raw_python"})
    .execute(my_agent_fn)
    .finalize()
    .analyze()
)

print(report.average_rating)       # LLM-graded score, 0–10
print(report.cosine_similarity)    # embedding cosine, 0–1 (None if not enabled)
print(report.jaccard_similarity)   # token-set overlap, 0–1 (None if not enabled)

See EVALUATIONS.md for the full guide — dataset builder, framework adapters, similarity metrics, and the complete API reference.


Links

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

agentx_python-0.4.11.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

agentx_python-0.4.11-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file agentx_python-0.4.11.tar.gz.

File metadata

  • Download URL: agentx_python-0.4.11.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for agentx_python-0.4.11.tar.gz
Algorithm Hash digest
SHA256 638ad976ed0a95eb7ec9d3bc506bf74655773bd0b11c3e9caa2045d609ca7b08
MD5 75bdb7c691442220595624e1e28c77ee
BLAKE2b-256 a6352557de71235cf60f54b846e358e1034025571b23e76e40d3c74ad9097ce9

See more details on using hashes here.

File details

Details for the file agentx_python-0.4.11-py3-none-any.whl.

File metadata

  • Download URL: agentx_python-0.4.11-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for agentx_python-0.4.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9519b5a405f8403db7990c80a11f80d1a57c6c7d86b99efd49c38faff8a1edc6
MD5 ce09638dc063ae42319c1141e7b79ef5
BLAKE2b-256 da8efee55976bf6d1c200bf3e2de66c99471e7afc5cef2a59ff87b24866fe10b

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