Skip to main content

DoDo - A stateful agentic framework

Project description

dodo

PyPI version License: MIT

A stateful agentic framework for building AI agents.

Installation

pip install dodoai
pip install dodoai[gemini]  # With Gemini support

Overview

from dodo import Agent, Gemini

agent = Agent(llm=Gemini(), tools=[add_todo, complete_todo])

await agent.do("add buy milk to my list")
await agent.do("mark buy milk as done")

ok = await agent.check("all tasks are completed")
if ok:
    print("Success!")

Features

Stateful agents

# Agent remembers context across tasks
await agent.do("calculate 25 * 4")
await agent.do("add 10 to the result")
await agent.do("multiply by 2")

Structured output (using Pydantic)

from pydantic import BaseModel

class Result(BaseModel):
    value: float
    expression: str

result = await agent.tell("the calculation result", schema=Result)

Verdicts with reasons

ok = await agent.check("result is greater than 100")
if ok:
    print("Success!")
else:
    print(f"Failed: {ok.reason}")

Usage

1. Create tools

Simple tools using @tool decorator:

from dodo import tool

@tool
async def calculator(expression: str) -> str:
    """Perform arithmetic calculations.

    Args:
        expression: Math expression to evaluate
    """
    return str(eval(expression))

Tools with dependencies using classes:

@tool
class SearchTool:
    """Search the database."""

    def __init__(self, database):
        self.database = database

    async def run(self, query: str) -> str:
        """
        Args:
            query: Search query
        """
        return self.database.search(query)

2. Define observation function

async def observe():
    """Return current environment state as a list of strings or Content objects."""
    return [f"Current user: {username}", f"History: {history}"]

3. Create agent and run tasks

from dodo import Agent, Gemini

agent = Agent(llm=Gemini(), tools=[calculator], observe=observe)

await agent.do("calculate 25 * 4 + 10")            # Do a task
result = await agent.tell("the last calculation")  # Get information
ok = await agent.check("result is greater than 100")  # Check a condition

4. Error handling

try:
    await agent.do("divide 10 by 0")
except TaskAbortedError as e:
    print(f"Task failed: {e}")

Supported LLMs

from dodo import Gemini

Gemini(model="gemini-2.5-flash")  # Default
Gemini(model="gemini-2.5-pro")    # Pro model

You can also implement your own LLM by extending the LLM base class:

from dodo import LLM

class MyLLM(LLM):
    async def call_tools(self, messages, tools):
        # Your LLM API call here
        pass

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

dodoai-0.1.1.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

dodoai-0.1.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dodoai-0.1.1.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dodoai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4148b9ca246dc3a0807a43776b0cd678bc003214140c3c99a93cb280a502c919
MD5 1351158a777e65b5322662cff5d8d2e2
BLAKE2b-256 ec1d227e6262dc534003167eee67d6daadf7a32463391cac082f2b99a8e7811d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dodoai-0.1.1.tar.gz:

Publisher: publish.yml on steve-z-wang/dodo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: dodoai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dodoai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f72840fc35614675bd29908270011aa91117a9f2baad48783381ca32e1a43df
MD5 b199f8de7db220bd3c12821c0b294060
BLAKE2b-256 e2f6fe966fb01a7ca13b754f3ea2ddd7811340f43d079f1c0e91892279aa43ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for dodoai-0.1.1-py3-none-any.whl:

Publisher: publish.yml on steve-z-wang/dodo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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