Skip to main content

agent-optimus

Python SDK for the Optimus backend API. Install with pip and call MSC construction, model routing, and full answer generation from Python.

Installation

pip install agent-optimus

Quick start

You can use Optimus with the exact same call pattern as OpenRouter/OpenAI. Only the import and API key differ.

from agent_optimus import OpenAI

client = OpenAI(api_key="your-api-token")

response = client.chat.completions.create(
    model="qwen/qwen3-32b",
    messages=[
        {"role": "user", "content": "Hello"}
    ],
)

print(response.choices[0].message.content)

Option 2 — official openai package

If you need the real OpenAI SDK types/objects:

pip install agent-optimus[openai]
from openai import OpenAI
from agent_optimus import create_openai_client

client = create_openai_client(api_key="your-api-token")

response = client.chat.completions.create(
    model="qwen/qwen3-32b",
    messages=[
        {"role": "user", "content": "Hello"}
    ],
)

print(response.choices[0].message.content)

Note: from openai import OpenAI alone cannot talk to Optimus directly, because Optimus uses internal end point instead of OpenAI's /v1/chat/completions. create_openai_client() wires that up for you.

Optimus-specific fields (routing_score, cost_usd, metrics) are available on response.optimus (built-in client) or inside the raw response payload (official client).

Native SDK usage

from agent_optimus import AgentOptimus

client = AgentOptimus(api_token="your-api-key")

# 1. Build an MSC from long context
msc = client.construct_msc(
    context="Italy dominates European silk production...",
    user_query="Who leads silk production in Europe?",
)
print(msc["msc_string"], msc["compression_ratio"])

# 2. Route only (no full MSC + answer pipeline)
routed = client.route(
    context="The Eiffel Tower is in Paris.",
    query="Where is the Eiffel Tower?",
)
print(routed["content"], routed["model_provider_detail"])

# 3. Full pipeline answer (MSC + route + generate)
answer = client.answer(
    context="The Eiffel Tower is in Paris.",
    query="Where is the Eiffel Tower?",
)
print(answer["content"], answer["metrics"])

Metadata

Release files for agent-optimus 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-optimus 0.1.2
File Size Uploaded Provenance
agent_optimus-0.1.2.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-optimus 0.1.2
File Interpreter ABI Platform
agent_optimus-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / agent_optimus-0.1.2.tar.gz

Download URL agent_optimus-0.1.2.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ce2c0ab2a7091e96d2cc91ee9cff9309ffb03883856b5e908119403cec62bade
BLAKE2b-256 checksum
How to use checksums
a9da77c60977f6894efad429dbdd155aabca87aa873eba621e9f2013866cac17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / agent_optimus-0.1.2-py3-none-any.whl

Download URL agent_optimus-0.1.2-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce552708ca99e7199d32cb9a4a316e421beda469c112b82032313ff2252c4e59
BLAKE2b-256 checksum
How to use checksums
cbab19a4d71332fdbb86a32ba694841e457d260ea12b95139745192d1dd30057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for agent-optimus 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page