swiftagent


Nameswiftagent JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummarySwiftAgent: Building AI Agents At SCALE
upload_time2025-02-01 08:04:26
maintainerNone
docs_urlNone
authorNone
requires_python<3.12,>=3.10
licenseCopyright (c) 2025 Openminder Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords agents interface llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SwiftAgent

<div align="center">

![Logo of Openminder AI](./docs/openminder_logo.jpeg)

# **SwiftAgent**

🦅 **SwiftAgent**: Build scalable & production-ready agents.

<h3>

<!-- TODO -->
<!-- [Homepage](https://www.crewai.com/) | [Documentation](https://docs.crewai.com/) | [Chat with Docs](https://chatg.pt/DWjSBZn) | [Examples](https://github.com/crewAIInc/crewAI-examples) | [Discourse](https://community.crewai.com) -->

</h3>

<!-- TODO -->
<!-- [![GitHub Repo stars](https://img.shields.io/github/stars/joaomdmoura/crewAI)](https://github.com/crewAIInc/crewAI)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) -->

</div>

## Table of contents

- [Why SwiftAgent?](#why-swiftagent)
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Key Features](#key-features)
- [Understanding Suites](#understanding-suites)
- [Examples](#examples)
  - [Weather Agent](#weather-agent)
<!-- - [Connecting Your Crew to a Model](#connecting-your-crew-to-a-model)
- [How CrewAI Compares](#how-crewai-compares)
- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq)
- [Contribution](#contribution)
- [Telemetry](#telemetry)
- [License](#license) -->

## 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

```bash
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:

```python
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:

```python
@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)
```python
await agent.run(task="Your task description here")
```

#### Persistent Mode (Long-running Service)
```python
from swiftagent.application.types import ApplicationType
await agent.run(type_=ApplicationType.PERSISTENT)
```

#### Suite Mode (Multiple Agents)
```python
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:

```python
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:

```python
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.

```python
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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "swiftagent",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.10",
    "maintainer_email": null,
    "keywords": "agents, interface, llm",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b2/39/b1cfb03d9ed0d917c3f2c1cbb62f96c29d45bcf6c2270892ef60cebb4113/swiftagent-0.0.2.tar.gz",
    "platform": null,
    "description": "# SwiftAgent\n\n<div align=\"center\">\n\n![Logo of Openminder AI](./docs/openminder_logo.jpeg)\n\n# **SwiftAgent**\n\n\ud83e\udd85 **SwiftAgent**: Build scalable & production-ready agents.\n\n<h3>\n\n<!-- TODO -->\n<!-- [Homepage](https://www.crewai.com/) | [Documentation](https://docs.crewai.com/) | [Chat with Docs](https://chatg.pt/DWjSBZn) | [Examples](https://github.com/crewAIInc/crewAI-examples) | [Discourse](https://community.crewai.com) -->\n\n</h3>\n\n<!-- TODO -->\n<!-- [![GitHub Repo stars](https://img.shields.io/github/stars/joaomdmoura/crewAI)](https://github.com/crewAIInc/crewAI)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) -->\n\n</div>\n\n## Table of contents\n\n- [Why SwiftAgent?](#why-swiftagent)\n- [Installation](#installation)\n- [Getting Started](#getting-started)\n- [Key Features](#key-features)\n- [Understanding Suites](#understanding-suites)\n- [Examples](#examples)\n  - [Weather Agent](#weather-agent)\n<!-- - [Connecting Your Crew to a Model](#connecting-your-crew-to-a-model)\n- [How CrewAI Compares](#how-crewai-compares)\n- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq)\n- [Contribution](#contribution)\n- [Telemetry](#telemetry)\n- [License](#license) -->\n\n## Why SwiftAgent?\nSwiftAgent 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.\n\nOne of SwiftAgent\u2019s core strengths is its persistence by design. Unlike standard, function-based solutions, SwiftAgent\u2019s 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.\n\nFurthermore, 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\u2019 decision processes, and even replay queries for debugging or performance optimization.\n\n## Installation\n\n```bash\npip install swiftagent\n```\n\n## Getting Started\n\n### Step 1: Create an Agent Instance\n\nStart by importing and instantiating a SwiftAgent. You can create either a named or unnamed agent:\n\n```python\nfrom swiftagent import SwiftAgent\n\n# Unnamed agent (for simple use cases)\nagent = SwiftAgent()\n\n# Named agent (required for persistent/suite modes)\nagent = SwiftAgent(name=\"MyCustomAgent\")\n```\n\n### Step 2: Define Actions\n\nActions are the core functionality of your agent. Use the `@agent.action` decorator to define what your agent can do:\n\n```python\n@agent.action(description=\"A human-readable description of what this action does\")\nasync def my_custom_action(param1: str, param2: int) -> str:\n    # Your action logic here\n    return result\n```\n\n### Step 3: Choose a Running Mode\n\nSwiftAgent supports three running modes, each suited for different use cases:\n\n#### Standard Mode (One-off Tasks)\n```python\nawait agent.run(task=\"Your task description here\")\n```\n\n#### Persistent Mode (Long-running Service)\n```python\nfrom swiftagent.application.types import ApplicationType\nawait agent.run(type_=ApplicationType.PERSISTENT)\n```\n\n#### Suite Mode (Multiple Agents)\n```python\nfrom swiftagent.suite import SwiftSuite\nsuite = SwiftSuite(name=\"MySuite\", agents=[agent1, agent2])\nawait suite.setup(host=\"localhost\", port=8001)\n```\n\n### Step 4: Connect to Your Agent\n\nFor standard mode, the agent processes the task immediately and returns.\n\nFor persistent or suite modes, use SwiftClient to send tasks:\n\n```python\nfrom swiftagent.client import SwiftClient\n\nclient = SwiftClient()\n\nawait client.send(\n    \"Your task description\",\n    agent_name=\"MyCustomAgent\"\n)\n```\n\n\n## Key Features\n\n### Actions\n\nActions are utilities or functionalities that an agent can perform. Much like we carry out everyday tasks \u2014 such as walking, talking, or using a computer\u2014agents can execute actions like checking the weather, writing a Google Doc, or retrieving current stock prices.\n\nSwiftAgent provides two primary methods to define actions:\n\n---\n\n#### 1. Using the `SwiftAgent.action` Decorator\n\nThis method allows you to register an action directly by decorating a function with the agent's own `action` decorator. Here\u2019s how you can do it:\n\n```python\nfrom swiftagent import SwiftAgent\n\n# Initialize your agent\nagent = SwiftAgent()\n\n# Define and register an action using the agent's decorator\n@agent.action(description=\"Description her\")\ndef sample_action(param1: str):\n    # Implementation of your action here\n    pass\n```\n\n---\n\n#### 2. Using the Standalone `action` Decorator with `add_action`\n\nAlternatively, 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.\n\n```python\nfrom swiftagent import SwiftAgent\nfrom swiftagent.actions import action\n\n# Initialize your agent\nagent = SwiftAgent()\n\n# Define the action using the standalone decorator\n@action(description=\"Description here\")\ndef sample_action(param1: str):\n    # Implementation of your action here\n    pass\n\n# Add the action to your agent\nagent.add_action(sample_action)\n```\n\n---\n\nBoth methods are fully supported in SwiftAgent! \n\n## Understanding Suites\nTBD\n\n## Examples\n\n### Weather Agent\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2025 Openminder Labs\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "SwiftAgent: Building AI Agents At SCALE",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/BRama10/swiftagent",
        "Repository": "https://github.com/BRama10/swiftagent.git"
    },
    "split_keywords": [
        "agents",
        " interface",
        " llm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f6b8462b3ce8def26ad3c4c2f7fe04d4a341a7e6bc5e0d24f3452d42808ef47e",
                "md5": "635b4ac20b8f5ca45f0b86dbf8def06f",
                "sha256": "dc1542bd2bbfd478a8161d992b11ad18045d0f6022ae2c7eebf9eec743741972"
            },
            "downloads": -1,
            "filename": "swiftagent-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "635b4ac20b8f5ca45f0b86dbf8def06f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.10",
            "size": 24637,
            "upload_time": "2025-02-01T08:04:24",
            "upload_time_iso_8601": "2025-02-01T08:04:24.568862Z",
            "url": "https://files.pythonhosted.org/packages/f6/b8/462b3ce8def26ad3c4c2f7fe04d4a341a7e6bc5e0d24f3452d42808ef47e/swiftagent-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b239b1cfb03d9ed0d917c3f2c1cbb62f96c29d45bcf6c2270892ef60cebb4113",
                "md5": "8719d65c138abf4dcdd5d70107d2e07c",
                "sha256": "8fd8989e7279fb98b7a84a173c0070a18a2f399154a440a4a941dd9f6bf45443"
            },
            "downloads": -1,
            "filename": "swiftagent-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8719d65c138abf4dcdd5d70107d2e07c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.10",
            "size": 16535,
            "upload_time": "2025-02-01T08:04:26",
            "upload_time_iso_8601": "2025-02-01T08:04:26.395593Z",
            "url": "https://files.pythonhosted.org/packages/b2/39/b1cfb03d9ed0d917c3f2c1cbb62f96c29d45bcf6c2270892ef60cebb4113/swiftagent-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-01 08:04:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BRama10",
    "github_project": "swiftagent",
    "github_not_found": true,
    "lcname": "swiftagent"
}
        
Elapsed time: 2.01039s