Skip to main content

Core primitives for the DynaBots orchestration framework family

Project description

dynabots-core

Core primitives for the DynaBots orchestration framework family.

Overview

dynabots-core provides the foundational building blocks shared across all DynaBots orchestration frameworks:

  • Protocols: Agent, LLMProvider, Judge, Tool - interfaces that define contracts
  • Value Objects: TaskResult, LLMMessage, LLMResponse - immutable data structures
  • Providers: Ready-to-use LLM adapters for OpenAI, Ollama, Anthropic

Installation

# Core only (bring your own LLM client)
pip install dynabots-core

# With OpenAI support
pip install dynabots-core[openai]

# With Ollama (local LLMs)
pip install dynabots-core[ollama]

# With all providers
pip install dynabots-core[all]

Quick Start

Define an Agent

from dynabots_core import Agent, TaskResult

class MyAgent:
    @property
    def name(self) -> str:
        return "MyAgent"

    @property
    def capabilities(self) -> list[str]:
        return ["search", "summarize"]

    async def process_task(self, task_description: str, context: dict) -> TaskResult:
        # Your agent logic here
        result = await self._do_work(task_description)
        return TaskResult.success(
            task_id=context["task_id"],
            data=result
        )

Use an LLM Provider

from dynabots_core.providers import OllamaProvider

# Local LLM via Ollama
llm = OllamaProvider(model="qwen2.5:72b")

response = await llm.complete([
    LLMMessage(role="system", content="You are a helpful assistant."),
    LLMMessage(role="user", content="Hello!")
])
print(response.content)

Create a Judge (for Orc!!)

from dynabots_core import Judge, Verdict

class LLMJudge:
    def __init__(self, llm: LLMProvider):
        self.llm = llm

    async def evaluate(self, task: str, submissions: list[dict]) -> Verdict:
        # Compare submissions and pick a winner
        prompt = f"Task: {task}\n\nSubmission A: {submissions[0]}\nSubmission B: {submissions[1]}\n\nWhich is better?"
        response = await self.llm.complete([LLMMessage(role="user", content=prompt)])
        return Verdict(winner=..., reasoning=response.content)

Framework Family

This package is part of the DynaBots framework family:

Package Description
dynabots-core Shared primitives (this package)
dynabots DAG-based orchestration with parallel waves
orc Challenge-based hierarchy with contested leadership

Protocols

Agent

class Agent(Protocol):
    @property
    def name(self) -> str: ...

    @property
    def capabilities(self) -> list[str]: ...

    async def process_task(self, task_description: str, context: dict) -> TaskResult: ...

LLMProvider

class LLMProvider(Protocol):
    async def complete(
        self,
        messages: list[LLMMessage],
        temperature: float = 0.1,
        max_tokens: int = 2000,
        json_mode: bool = False,
    ) -> LLMResponse: ...

Judge

class Judge(Protocol):
    async def evaluate(self, task: str, submissions: list[dict]) -> Verdict: ...

Tool

class Tool(Protocol):
    @property
    def name(self) -> str: ...

    @property
    def description(self) -> str: ...

    @property
    def parameters_schema(self) -> dict: ...

    async def execute(self, **kwargs) -> Any: ...

License

MIT

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

dynabots_core-0.1.1.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

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

dynabots_core-0.1.1-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file dynabots_core-0.1.1.tar.gz.

File metadata

  • Download URL: dynabots_core-0.1.1.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for dynabots_core-0.1.1.tar.gz
Algorithm Hash digest
SHA256 019d96c1e117fd7978544b08b5bcf305fdb267ab9e4d6a78b3e47c2025353451
MD5 ae47a35305bc249bb8aa839701e34bfb
BLAKE2b-256 a63118d93baefdba8f098d34d019573c6b47b27b69681bcc79a04672716a2aa9

See more details on using hashes here.

File details

Details for the file dynabots_core-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dynabots_core-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for dynabots_core-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a95dd97c8b394c22f9b84a9b18c4ab05ca85ad6b20e1fc8d98357da7462ef28
MD5 68fc56bc9db902f1596fe9373933c881
BLAKE2b-256 c3d3d4994b94d8440e66af681db58af5bd43811e7ca1a32c86b34e93a4d95a45

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