Skip to main content

High-level Copass agent SDK — hosted agent-runtime routing + integrations + one-liner OAuth flow (Python mirror of @copass/agent-router)

Project description

copass-agent-router

High-level Copass agent SDK. Python mirror of @copass/agent-router — wraps copass-core + copass-core-agents into a one-import surface that runs a full agent lifecycle: connect an integration, run an agent turn, stream events.

Install

pip install copass-agent-router

Quickstart

import asyncio, webbrowser
from copass_agent_router import AgentRouter, RunAgentOptions
from copass_core import ApiKeyAuth

async def main():
    router = AgentRouter(
        auth=ApiKeyAuth(key="olk_..."),
        sandbox_id="sb_...",
    )

    # Connect an integration (OAuth, local browser, webhook fallback via reconcile).
    result = await router.integrations.connect(
        "github",
        on_connect_url=lambda url: webbrowser.open(url),
    )
    print("connected:", result.connection["app"], result.connection["name"])

    # Run an agent.
    async for event in router.run(RunAgentOptions(
        provider="anthropic",
        model="claude-opus-4-7",
        system="You are a helpful agent.",
        message="Summarize my latest GitHub issues.",
        end_user_id="u-123",
    )):
        t = type(event).__name__
        if t == "AgentTextDelta":
            print(event.text, end="", flush=True)
        elif t == "AgentFinish":
            print(f"\n[done] {event.stop_reason}")

asyncio.run(main())

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

copass_agent_router-0.5.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

copass_agent_router-0.5.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file copass_agent_router-0.5.0.tar.gz.

File metadata

  • Download URL: copass_agent_router-0.5.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for copass_agent_router-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2d55f7f7a5ffb9396e96ff5ca3b3da7657da465ad8f8300eb22ad37fc2c89496
MD5 91461e625d2e53a03cb235b605dba8e7
BLAKE2b-256 77fc8b7a7d2e87d4bb2637e2c301b866865ec31f430e4fbf4168d8fe44350c0e

See more details on using hashes here.

File details

Details for the file copass_agent_router-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for copass_agent_router-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5da69b9b6b7ed69a35a67e4aa01ecb7ad75d3123f79040f8048b2529ba94cc61
MD5 234a37a614df9665dce937be1fa23cb2
BLAKE2b-256 a7485b6a81ac9621fe9c8b52ebd73e621954bdf57424c1ab2f000a9f77b09c73

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