Skip to main content

A lightweight multi-agent orchestration framework with better control, easy to use for complex to simple use cases. Developer friendly with more visibility and supports all models with OpenAI compatible API.

Project description

USF Agents — Simplify the Complex, Amplify the Intelligent for Enterprise

Orchestrate multiple agents with ease: register agents, integrate tools, define custom instructions, and leverage multiple models.
Enterprise-grade and production-ready, with full control, deep customization, strong defaults, clear boundaries, and developer-focused APIs.


USF Agents

This is the official documentation for the USF Agents Python SDK.

Important: Responses are now OpenAI-compatible by default

  • Non-streaming methods return OpenAI chat.completion dicts: object="chat.completion"
  • Streaming methods yield OpenAI chat.completion.chunk dicts: object="chat.completion.chunk"
  • USF-only stages are indicated via vendor extension x_usf, e.g. {"stage":"plan"} or {"stage":"tool_result"}

📖 Docs: Quickstart | Installation | Configuration | Troubleshooting / FAQ


Installation & Requirements

Requirements

  • Python 3.9+
  • USF API key (set as an environment variable)

Install the SDK

pip install usf-agents

Other package managers:

# uv
uv add usf-agents

# poetry
poetry add usf-agents

# pdm
pdm add usf-agents

Set Your API Key

# macOS/Linux
export USF_API_KEY=YOUR_KEY

# Windows PowerShell
$env:USF_API_KEY="YOUR_KEY"

# Windows CMD
set USF_API_KEY=YOUR_KEY

(Optional) Virtual Environment

python -m venv .venv

# macOS/Linux
source .venv/bin/activate

# Windows PowerShell
.venv\Scripts\Activate.ps1

Verify Installation

pip show usf-agents

Minimal import check:

python - <<'PY'
try:
    import usf_agents
    print("usf_agents import: OK")
except Exception as e:
    print("Import failed:", e)
PY

Quick Sanity Run

Requires your USF_API_KEY to be set.

Non-streaming (OpenAI chat.completion):

# sanity.py
import os
import asyncio
import nest_asyncio
from usf_agents import ManagerAgent

nest_asyncio.apply()

async def main():
    mgr = ManagerAgent(
        usf_config={
            "api_key": os.getenv("USF_API_KEY"),
            "model": "usf-mini",
        }
    )
    completion = await mgr.run("Say 'hello world'", {"mode": "auto"})
    # completion is OpenAI-compatible: object="chat.completion"
    choice = (completion.get("choices") or [{}])[0] or {}
    message = choice.get("message") or {}
    if message.get("tool_calls"):
        print("Tool Calls (finish_reason=tool_calls):", message.get("tool_calls"))
    else:
        print("Final:", (message.get("content") or ""))

if __name__ == "__main__":
    asyncio.run(main())

Streaming (OpenAI chat.completion.chunk):

# stream_sanity.py
import os
import asyncio
import nest_asyncio
from usf_agents import ManagerAgent

nest_asyncio.apply()

async def main():
    mgr = ManagerAgent(
        usf_config={
            "api_key": os.getenv("USF_API_KEY"),
            "model": "usf-mini",
        }
    )
    async for chunk in mgr.stream(
        "Briefly introduce yourself.",
        {"mode": "auto", "streaming": {"plan_chunk_size": 80}}
    ):
        # chunk is OpenAI-compatible: object="chat.completion.chunk"
        delta = ((chunk.get("choices") or [{}])[0] or {}).get("delta") or {}
        x_usf = chunk.get("x_usf") or {}
        stage = x_usf.get("stage")
        if "tool_calls" in delta:
            print("stream tool_calls:", delta["tool_calls"])
        elif "content" in delta and delta["content"]:
            if stage == "plan":
                print("stream plan delta:", delta["content"])
            else:
                print("stream final delta:", delta["content"])
        elif stage == "tool_result":
            print("stream tool_result:", x_usf)
        finish = ((chunk.get("choices") or [{}])[0] or {}).get("finish_reason")
        if finish:
            print("stream finished with reason:", finish)

if __name__ == "__main__":
    asyncio.run(main())

Run it:

python sanity.py
python stream_sanity.py

Migration Note

This release adopts OpenAI-compatible response formats by default:

  • ManagerAgent.run(...) returns an OpenAI chat.completion dict.
  • ManagerAgent.stream(...) yields OpenAI chat.completion.chunk dicts.
  • Ephemeral helpers (run_ephemeral, run_ephemeral_final, run_many_parallel) now produce OpenAI shapes as well.

Breaking changes:

  • Legacy shapes like {'status': 'final' | 'tool_calls', 'content': ..., 'tool_calls': [...]} are removed.
  • Update integrations to read choices[0].message.* for non-stream, and choices[0].delta.* for streaming.

Documentation

Getting Started

Tools

Multi-Agent

Jupyter Notebook Guides

FastAPI Apps


License

See LICENSE.

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

usf_agents-1.1.0.post12.tar.gz (70.0 kB view details)

Uploaded Source

Built Distribution

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

usf_agents-1.1.0.post12-py3-none-any.whl (63.0 kB view details)

Uploaded Python 3

File details

Details for the file usf_agents-1.1.0.post12.tar.gz.

File metadata

  • Download URL: usf_agents-1.1.0.post12.tar.gz
  • Upload date:
  • Size: 70.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for usf_agents-1.1.0.post12.tar.gz
Algorithm Hash digest
SHA256 0f567e1823e89b84b714828477c9f19399e348557ee8ba5ecc49417edbf787b4
MD5 0b89d02ca9e3a4f0826f69044f6638aa
BLAKE2b-256 602146daf44001d7f6ed31ad5de8436abcb66c5ef2866b825c4991a1932dee9a

See more details on using hashes here.

File details

Details for the file usf_agents-1.1.0.post12-py3-none-any.whl.

File metadata

File hashes

Hashes for usf_agents-1.1.0.post12-py3-none-any.whl
Algorithm Hash digest
SHA256 a523deb1154de6310542a5b4b73bc16305d36e6a20a5b83a594a1e321b47ca48
MD5 9884892cf47387cebc071cb5c1c87b32
BLAKE2b-256 4f3a2d7ebaf7b95d6b5e0a82d9d7d828d7590803e6123949bf9fa6d2810d1f3a

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