Skip to main content

DBOS integration for the OpenAI Agents SDK

Project description

Durable OpenAI Agents

Durable execution for the OpenAI Agents SDK using DBOS.

Installation

pip install dbos-openai-agents

Usage

Call your agent using DBOSRunner.run() from a @DBOS.workflow(). Annotate tool calls and guardrails with @DBOS.step().

import asyncio
from agents import Agent, function_tool
from dbos import DBOS, DBOSConfig
from dbos_openai import DBOSRunner

# Decorate tool calls and guardrails with @DBOS.step() for durable execution
@function_tool
@DBOS.step()
async def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return f"Sunny in {city}"

agent = Agent(name="weather", tools=[get_weather])

# Use DBOSRunner to call your agent from a workflow
@DBOS.workflow()
async def run_agent(user_input: str) -> str:
    result = await DBOSRunner.run(agent, user_input)
    return str(result.final_output)


async def main():
    output = await run_agent("How is the weather in San Francisco")
    print(output)


if __name__ == "__main__":
    config: DBOSConfig = {
        "name": "my-agent",
    }
    DBOS(config=config)
    DBOS.launch()
    asyncio.run(main())

DBOSRunner.run() is a drop-in replacement for Runner.run() with the same arguments. It must be called from within a @DBOS.workflow().

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

dbos_openai_agents-0.2.0.tar.gz (147.7 kB view details)

Uploaded Source

Built Distribution

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

dbos_openai_agents-0.2.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file dbos_openai_agents-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for dbos_openai_agents-0.2.0.tar.gz
Algorithm Hash digest
SHA256 111c403e45f37401089ea5f54851fbe775fd82056d7ba0ed460c040e4630f993
MD5 8bfbcd65863ee9b3c2dca5301128b455
BLAKE2b-256 0ebfa2e77db7b500b1955aa46395407c9e81b596a3d22f82d78418eafe14ad45

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbos_openai_agents-0.2.0.tar.gz:

Publisher: publish.yml on dbos-inc/dbos-openai-agents

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

File details

Details for the file dbos_openai_agents-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dbos_openai_agents-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f819a185eca67564a7147771cb0deda042522c054a64f5d288fd527e36ee0238
MD5 b5cf45285b2e1001e6fc0045436aca53
BLAKE2b-256 465e1699d3ed067b3f4160dd0d2b43568330a67c11d6da2668c62dab58c18988

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbos_openai_agents-0.2.0-py3-none-any.whl:

Publisher: publish.yml on dbos-inc/dbos-openai-agents

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