Skip to main content

SwiftAgent: Building AI Agents At SCALE

Project description

SwiftAgent

Logo of Openminder AI

SwiftAgent

🦅 SwiftAgent: Build scalable & production-ready agents.

Table of contents

Why SwiftAgent?

SwiftAgent is designed to be truly simple yet remarkably flexible, offering a streamlined experience unlike more complex alternatives such as CrewAI or Autogen. With a minimal learning curve, SwiftAgent lets you get started quickly, enabling you to build robust agents without the overhead of unnecessary complexity. Its clear, concise API is inspired by popular web frameworks like FastAPI and Flask, making it especially accessible for web developers and software engineers alike.

One of SwiftAgent’s core strengths is its persistence by design. Unlike standard, function-based solutions, SwiftAgent’s agents are built to remain active over time and handle multiple queries in parallel. This design ensures that your agents are not only responsive but also capable of managing ongoing interactions and complex workflows without requiring additional scaffolding.

Furthermore, SwiftAgent supports multi-agent collaboration, allowing multiple agents to work together seamlessly to tackle intricate tasks. Combined with its integrated detailed analytics and replay capabilities, you can monitor every interaction, gain deep insights into your agents’ decision processes, and even replay queries for debugging or performance optimization.

Installation

pip install swiftagent

Getting Started

Step 1: Create an Agent Instance

Start by importing and instantiating a SwiftAgent. You can create either a named or unnamed agent:

from swiftagent import SwiftAgent

# Unnamed agent (for simple use cases)
agent = SwiftAgent()

# Named agent (required for persistent/suite modes)
agent = SwiftAgent(name="MyCustomAgent")

Step 2: Define Actions

Actions are the core functionality of your agent. Use the @agent.action decorator to define what your agent can do:

@agent.action(description="A human-readable description of what this action does")
async def my_custom_action(param1: str, param2: int) -> str:
    # Your action logic here
    return result

Step 3: Choose a Running Mode

SwiftAgent supports three running modes, each suited for different use cases:

Standard Mode (One-off Tasks)

await agent.run(task="Your task description here")

Persistent Mode (Long-running Service)

from swiftagent.application.types import ApplicationType
await agent.run(type_=ApplicationType.PERSISTENT)

Suite Mode (Multiple Agents)

from swiftagent.suite import SwiftSuite
suite = SwiftSuite(name="MySuite", agents=[agent1, agent2])
await suite.setup(host="localhost", port=8001)

Step 4: Connect to Your Agent

For standard mode, the agent processes the task immediately and returns.

For persistent or suite modes, use SwiftClient to send tasks:

from swiftagent.client import SwiftClient

client = SwiftClient()

await client.send(
    "Your task description",
    agent_name="MyCustomAgent"
)

Key Features

Actions

Actions are utilities or functionalities that an agent can perform. Much like we carry out everyday tasks — such as walking, talking, or using a computer—agents can execute actions like checking the weather, writing a Google Doc, or retrieving current stock prices.

SwiftAgent provides two primary methods to define actions:


1. Using the SwiftAgent.action Decorator

This method allows you to register an action directly by decorating a function with the agent's own action decorator. Here’s how you can do it:

from swiftagent import SwiftAgent

# Initialize your agent
agent = SwiftAgent()

# Define and register an action using the agent's decorator
@agent.action(description="Description her")
def sample_action(param1: str):
    # Implementation of your action here
    pass

2. Using the Standalone action Decorator with add_action

Alternatively, you can create an action using the standalone action decorator and then register it with your agent by calling the add_action method. This approach offers flexibility, especially if you prefer to separate the action definition from the agent's configuration, or want to create reusable actions.

from swiftagent import SwiftAgent
from swiftagent.actions import action

# Initialize your agent
agent = SwiftAgent()

# Define the action using the standalone decorator
@action(description="Description here")
def sample_action(param1: str):
    # Implementation of your action here
    pass

# Add the action to your agent
agent.add_action(sample_action)

Both methods are fully supported in SwiftAgent!

Understanding Suites

TBD

Examples

Weather Agent

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

swiftagent-0.0.3.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

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

swiftagent-0.0.3-py3-none-any.whl (55.3 kB view details)

Uploaded Python 3

File details

Details for the file swiftagent-0.0.3.tar.gz.

File metadata

  • Download URL: swiftagent-0.0.3.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for swiftagent-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1bac23186aa2262f8485332c125593ea87f36178d4a7e0a13238b86eb311fa4e
MD5 77102c048e67add1aa14aba22b1e3757
BLAKE2b-256 bedd3175a573439b5c3fe473a6c81fa8be42a341439daa9cdcd7d21f91758dc6

See more details on using hashes here.

File details

Details for the file swiftagent-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: swiftagent-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 55.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for swiftagent-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2d5f00e2a572c407de0fc51c59abe7ee125da07be32fd7909a2fc2afe23c3963
MD5 33ce405f4c46c8a94269f66a10b6e837
BLAKE2b-256 9244879d7ac25d2ffcbc4426a553837eec9e811fd50cf2d400f4a01d3df873bb

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