Skip to main content

Agent SDK for AgentArea - agentic AI components

Project description

[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)

AgentArea Agents SDK

PyPI Python Version License Code Style GitHub Stars GitHub Forks Build Status Discord MCP

[Documentation] [Examples]

Independent SDK for Agent Networks, Task Orchestration, and Distributed Runners

AgentArea Agents SDK enables building scalable agent networks with task-driven workflows, featuring zero dependencies, multi-provider LLM support, extensible tools, and integration with independent runners like Temporal, Restate, or Dapr for distributed execution.


โœจ Key Features

  • ๐ŸŒ Agent Networks: Multi-agent collaboration with event-driven communication and orchestration
  • ๐Ÿ“‹ Task Management: Comprehensive task creation, assignment, progress tracking, and evaluation
  • ๐Ÿƒ Independent Runners: Extensible base for distributed execution using Temporal, Restate, Dapr, or custom runners
  • ๐Ÿค– Multi-Provider LLM Support: Unified interface for OpenAI, Claude, Ollama, and 100+ models via LiteLLM
  • ๐Ÿ› ๏ธ Extensible Tool System: Built-in tools for calculations, MCP integration, human-in-loop, and task operations
  • โšก ReAct Framework: Structured reasoning and acting with streaming support for networked agents
  • ๐Ÿ”’ Type Safety: Comprehensive Pydantic models and type hints throughout
  • ๐Ÿš€ Async/Await Ready: Full asynchronous support for efficient, distributed execution
  • ๐Ÿ“Š Comprehensive Testing: Unit, integration, and distributed workflow tests with 50%+ coverage
  • ๐Ÿ“š Developer Friendly: Clean architecture, detailed docs, and easy integration for scalable systems

๐Ÿ’ฌ Contact

Welcome to join our community on

Discord Email
opensource@agentarea.ai

๐Ÿ“‹ Table of Contents


๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11 or higher
  • pip package manager

Installation

From PyPI (when published):

pip install agentarea-agents-sdk

From source (development):

# Clone the repository
git clone https://github.com/agentarea/agentarea-agents-sdk.git
cd agentarea-agents-sdk

# Install in editable mode with dev dependencies
pip install -e .[dev]

Basic Agent Network Example

Create a simple agent network with task assignment.

import asyncio
from agentarea.agent_kit.agents.network import AgentNetwork
from agentarea.agent_kit.agents import create_agent
from agentarea.agent_kit.tasks.tasks import create_task

async def main():
    # Create agents in a network
    network = AgentNetwork()
    math_agent = create_agent(
        name="Math Agent",
        instruction="You are a math specialist.",
        model="ollama_chat/qwen2.5"
    )
    coordinator = create_agent(
        name="Coordinator",
        instruction="Assign tasks to specialists.",
        model="ollama_chat/qwen2.5"
    )
    network.add_agent(math_agent)
    network.add_agent(coordinator)

    # Create and assign a task
    task = create_task(
        description="Calculate 25 * 4 + 15",
        assignee="Math Agent"
    )
    network.assign_task(task)

    # Run the network
    async for event in network.run():
        print(f"Network event: {event}")

asyncio.run(main())

Task Orchestration Example

Manage tasks across agents.

import asyncio
from agentarea.agent_kit.tasks.task_service import TaskService
from agentarea.agent_kit.agents import create_agent

async def task_example():
    service = TaskService()
    agent = create_agent(
        name="Task Agent",
        instruction="Handle assigned tasks.",
        model="openai/gpt-4"
    )

    # Create task
    task_id = await service.create_task(
        description="Research AI trends",
        agent=agent
    )

    # Monitor progress
    progress = await service.get_task_progress(task_id)
    print(f"Task progress: {progress}")

    # Complete task
    await service.complete_task(task_id, result="AI trends summary")

asyncio.run(task_example())

๐ŸŒ Agent Networks

The SDK provides AgentNetwork for building multi-agent systems:

  • Event-driven communication between agents
  • Role-based agent assignment
  • Network orchestration for complex workflows
  • Integration with tasks for distributed processing

Example: See basic network example above. For advanced setups, use network.py for custom topologies.


๐Ÿ“‹ Task Management

Robust task system via tasks/ module:

  • Task creation with descriptions, assignees, and goals
  • TaskService for CRUD operations (create, read, update, delete)
  • Progress evaluation with GoalProgressEvaluator
  • Human-in-loop integration for oversight
  • Toolset for task-related operations (e.g., TasksToolset)

Supports hierarchical tasks and dependencies for orchestration.


๐Ÿƒ Distributed Runners

Extensible runner system for independent deployment:

  • BaseAgentRunner: Abstract base for custom runners
  • Integration points for Temporal (workflow orchestration), Restate (stateful workflows), Dapr (service invocation)
  • Async execution with state persistence
  • Scalable for cloud-native environments

Example integration (Temporal):

from temporalio import workflow
from agentarea.agent_kit.runners import BaseAgentRunner

class TemporalRunner(BaseAgentRunner):
    @workflow.defn
    async def run_workflow(self, agent, task):
        # Implement Temporal workflow
        return await self.execute_agent(agent, task)

Adapt for Restate or Dapr via service calls and state management.


๐Ÿ“š Examples

Run built-in examples:

# Network example
python examples/test_agentic_network.py

# Task example (adapt from tests)
python -m agentarea.agent_kit.example

Examples demonstrate:

  • Agent networks and communication
  • Task creation and assignment
  • Distributed runner stubs
  • Tool usage in networked contexts

See examples/ for more.


๐Ÿ—๏ธ Architecture

Modular design focused on networks, tasks, and runners:

agentarea-agents-sdk/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ agentarea.agent_kit/
โ”‚       โ”œโ”€โ”€ agents/          # Agents and networks
โ”‚       โ”‚   โ”œโ”€โ”€ agent.py     # Base Agent
โ”‚       โ”‚   โ”œโ”€โ”€ network.py   # AgentNetwork
โ”‚       โ”‚   โ””โ”€โ”€ multi_agent.py
โ”‚       โ”œโ”€โ”€ tasks/           # Task management
โ”‚       โ”‚   โ”œโ”€โ”€ tasks.py     # Task models
โ”‚       โ”‚   โ””โ”€โ”€ task_service.py
โ”‚       โ”œโ”€โ”€ runners/         # Execution engines
โ”‚       โ”‚   โ””โ”€โ”€ base.py      # BaseAgentRunner
โ”‚       โ”œโ”€โ”€ models/          # LLM integration
โ”‚       โ”œโ”€โ”€ tools/           # Tool system (incl. tasks_toolset)
โ”‚       โ”œโ”€โ”€ context/         # Context for networks
โ”‚       โ”œโ”€โ”€ goal/            # Task evaluation
โ”‚       โ””โ”€โ”€ prompts.py
โ”œโ”€โ”€ tests/                   # Tests for networks/tasks/runners
โ”œโ”€โ”€ examples/                # Network and task examples
โ”œโ”€โ”€ docs/
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ pyproject.toml

๐Ÿ”Œ Components

Agent Networks (agents/network.py)

  • AgentNetwork: Orchestrate multiple agents
  • Event handling and inter-agent messaging
  • Task routing and coordination

Task Management (tasks/)

  • Task: Core task entity
  • TaskService: Service layer for operations
  • Integration with agents and tools

Distributed Runners (runners/)

  • BaseAgentRunner: For custom implementations
  • Support for stateful, distributed execution

Other Components

  • LLM Models: Provider-agnostic
  • Tools: Extensible with task-specific tools
  • Prompts: ReAct for networked reasoning

๐Ÿ“– Supported LLM Providers

Via LiteLLM (100+ models). See examples above for usage.

OpenAI

model = LLMModel(provider_type="openai", model_name="gpt-4", api_key="your-key")

Anthropic

model = LLMModel(provider_type="anthropic", model_name="claude-3-opus-20240229", api_key="your-key")

Ollama

model = LLMModel(provider_type="ollama_chat", model_name="qwen2.5")

Full list: LiteLLM docs.


๐Ÿงช Testing

pip install -e .[dev]
pytest -q

# Network and task tests
pytest tests/test_agent.py -v
pytest tests/test_task_orchestration.py -v
pytest --cov=src/agentarea.agent_kit --cov-report=term-missing

Includes tests for networks, tasks, and runner integrations.


๐Ÿ’ป Development

Setup:

git clone https://github.com/agentarea/agentarea-agents-sdk.git
cd agentarea-agents-sdk
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]

# Lint, type check, test
ruff check src tests
mypy src
pytest

Uses Ruff, MyPy, Pytest. Focus on network/task coverage.


๐Ÿค Contributing

  1. Fork the repo
  2. Create feature branch: git checkout -b feature/network-enhancement
  3. Commit: git commit -m 'Enhance agent networks'
  4. Push: git push origin feature/network-enhancement
  5. Open PR

Emphasize contributions to networks, tasks, runners. Guidelines: PEP 8, types, tests.

See CONTRIBUTING.md for details.


๐Ÿ“„ License

MIT License - see LICENSE.


๐Ÿ‘ฅ Contributors โœจ

Thanks to these wonderful people:

This project follows the all-contributors specification.

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

agentarea_agents_sdk-0.0.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

agentarea_agents_sdk-0.0.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file agentarea_agents_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: agentarea_agents_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for agentarea_agents_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3957e814fab64a4167ff2275a5837e34cf9d591e3d7389d27bb1bb9ca9de8569
MD5 655f712f08bf4078eb10c67455c7457c
BLAKE2b-256 3ce1ffa6c5273d89e025e97923fbd6fed8a20bf7c3bd9cae17e7e9024685e082

See more details on using hashes here.

File details

Details for the file agentarea_agents_sdk-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for agentarea_agents_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c176141768ebaf3766d7b699cadad43c577f156e81289362a0576606b0800f5
MD5 c8e7cfc63f0a2963ff30eec1dd80afe8
BLAKE2b-256 3ec1ffd272dc2589edfaaef2b637d2652c5f10bf5b6fd12890cd96e12b95057e

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