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_agents 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.3.0.tar.gz (148.4 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.3.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbos_openai_agents-0.3.0.tar.gz
  • Upload date:
  • Size: 148.4 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.3.0.tar.gz
Algorithm Hash digest
SHA256 bc8da5cb9b652ccc4b7f3da419d655d793e4a3f9ff1ca6b576a40a210448ee48
MD5 b9e1fe67d790a5c76e6feb38139bcbe7
BLAKE2b-256 70383fe529a9539e5a48eb7caa8558e6ec2c745050ac33f8d4c4c0bea4ca7d13

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbos_openai_agents-0.3.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dbos_openai_agents-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13609dab5c868e03d25096282adbb58e7abbc33a204eadb9fb01c0f452b5f156
MD5 ddcd09506d8d339bac8675e0aa0846e4
BLAKE2b-256 bcf968b5f8a25efd03f33234ae29b872117a0cfd4465827f3f18c7d9d7b947bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbos_openai_agents-0.3.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