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 (Python SDK)

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

Production-grade Python SDK to design, orchestrate, and safely execute multi-agent systems with OpenAI-compatible APIs. Built for developers who need control, visibility, and reliability for simple to complex use cases.


Overview

USF Agents is a lightweight multi-agent orchestration SDK that streamlines:

  • Planning → tool execution → final answers with predictable policies
  • Docstring/YAML-driven tool schemas (no verbose JSON required)
  • Sub-agent composition (manager + sub‑agents) in a few lines
  • OpenAI-compatible runtime and types

Designed for:

  • Developers needing a simple, controllable agent runtime with OpenAI-compatible APIs

Key Features

  • Docstring/YAML-driven tool schemas with validation
  • @tool decorator for defaults or explicit schema
  • Batch tool registration and module discovery
  • Auto Execution Modes: disable | auto | agent-only | tool-only
  • Multi-agent orchestration (manager + sub-agents)

Learn more:


ManagerAgent API rules

  • Constructor: ManagerAgent(usf_config: dict, backstory: str = '', goal: str = '', tools: list | None = None)
    • Only usf_config is required at construction time.
    • Does not accept name, description, or context_mode. The internal name is always "Manager" (id "manager").
  • Configure system context via usf_config.introduction and usf_config.knowledge_cutoff, plus optional constructor backstory/goal.
  • When calling await ManagerAgent.run(...) with a TaskPayload-like dict, only the "task" field is used; "context" is ignored (Manager shapes its own context).
  • Modes allowed: 'disable' | 'auto' | 'agent-only' | 'tool-only'.

Advantages

  • Developer-friendly: fewer lines, strong defaults, and explicit controls
  • Compatibility: OpenAI-compatible APIs and multiple providers
  • Extensibility: simple tool creation, sub-agent orchestration, registry flows
  • Operational simplicity: minimal setup, predictable behavior

Installation & Requirements

Requirements

  • Python 3.8+
  • USF API key (set as environment variable USF_API_KEY)

Install the SDK

  • pip (recommended):
pip install usf-agents
  • 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

Examples

Below are minimal, copy/paste runnable examples. For comprehensive guides and advanced patterns, see the documentation links.

Example 1 — Minimal agent (hello world) using ManagerAgent

import os
import asyncio
from usf_agents import ManagerAgent

async def main():
    mgr = ManagerAgent(usf_config={'api_key': os.getenv('USF_API_KEY'), 'model': 'usf-mini'})
    result = await mgr.run("Say 'hello world'")
    # result is a dict like {'status': 'final', 'content': '...'}
    print("Final:", result.get("content"))

asyncio.run(main())

Example 2 — Minimal tool with @tool decorator

import os
import asyncio
from usf_agents import ManagerAgent
from usf_agents.runtime.decorators import tool

@tool(schema={
    "description": "Calculate the sum of a list of integers.",
    "parameters": {
      "type": "object",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {"type": "integer"},
          "description": "List of integers to sum."
        }
      },
      "required": ["numbers"]
    }
})
def calc_sum(numbers: list[int]) -> int:
    return sum(numbers)

async def main():
    mgr = ManagerAgent(usf_config={'api_key': os.getenv('USF_API_KEY'), 'model': 'usf-mini'})
    mgr.add_function_tool(calc_sum)  # optional alias via @tool or add_function_tool(alias="...")
    result = await mgr.run([{"role": "user", "content": "Use calc_sum for 10,20,30"}], {"mode": "auto"})
    print("Final:", result.get("content"))

asyncio.run(main())

Example 3 — Compose a sub-agent as a tool and call it

import os
import asyncio
from usf_agents import ManagerAgent, SubAgent

async def main():
    api_key = os.getenv("USF_API_KEY")
    mgr = ManagerAgent(usf_config={'api_key': api_key, 'model': 'usf-mini'})

    # Create a sub-agent with a clear description (required)
    writer = SubAgent({
        "name": "writer",
        "context_mode": "NONE",
        "description": "Draft short outputs",
        "usf_config": {"api_key": api_key, "model": "usf-mini"},
    })
    # Expose sub-agent as a tool on the manager. Optionally alias the tool name.
    mgr.add_sub_agent(writer, alias="agent_writer")

    # Ask the manager; it can choose to call the sub-agent tool based on the task
    result = await mgr.run([{"role": "user", "content": "Ask agent_writer to write a haiku"}], {"mode": "auto"})
    print("Final:", result.get("content"))

asyncio.run(main())

Complete Documentation

Start here

Tools

Multi-Agent

Jupyter notebook guides

FastAPI apps


License

License: USF Agents SDK License
See: ./LICENSE

Summary

  • Permitted Use: anyone may use this software for any purpose.
  • Restricted Activities: no modification of the code; no commercial use; no creation of competitive products.
  • Attribution: retain this license notice and attribute UltraSafe AI Team.

© 2025 UltraSafe AI Team

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.0.0.post8.tar.gz (60.6 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.0.0.post8-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

File details

Details for the file usf_agents-1.0.0.post8.tar.gz.

File metadata

  • Download URL: usf_agents-1.0.0.post8.tar.gz
  • Upload date:
  • Size: 60.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for usf_agents-1.0.0.post8.tar.gz
Algorithm Hash digest
SHA256 0b3808eea8245d954a94373a4e98919ee747c993925e17c0e99dd2ceae0013be
MD5 6c2b3860b82a365fbb3ebdfba90f3181
BLAKE2b-256 7261818e68a9c53d0adfec6cf0bf756414c7c30b087d6b2fb6e7c348fcaeeb92

See more details on using hashes here.

File details

Details for the file usf_agents-1.0.0.post8-py3-none-any.whl.

File metadata

File hashes

Hashes for usf_agents-1.0.0.post8-py3-none-any.whl
Algorithm Hash digest
SHA256 2c3ebdff8351350b9a5a90c2336d1a9516ed96db568c89f5d71ab3d598feeae4
MD5 a8ec8185b360e3081a6473653736039b
BLAKE2b-256 15109db048509930da12ffe5432ace4f484230acc73013ed8236a95fb99e39dd

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