Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

agent-framework-hosting-responses

OpenAI Responses-shaped helpers for app-owned Agent Framework hosting.

This package provides the Responses-specific conversion layer:

  • responses_to_run(...) — convert a Responses request body into Agent Framework run values.
  • responses_session_id(...) — return (session_id, is_conversation_id) for a prior resp_* response id or conv_* conversation id, or (None, None) when neither is present.
  • create_conversation_id(...) — mint a Responses-shaped conversation id.
  • create_response_id(...) — mint a Responses-shaped response id.
  • responses_from_run(...) — convert an AgentResponse into a Responses-compatible JSON payload.
  • responses_from_streaming_run(...) — convert an Agent Framework ResponseStream into Responses-compatible SSE events.

FastAPI/Starlette/Django/Azure Functions code owns route registration, authentication, status codes, response construction, and background work.

from agent_framework_hosting import AgentState
from agent_framework_hosting_responses import (
    create_response_id,
    responses_from_run,
    responses_session_id,
    responses_to_run,
)
from fastapi import Body, FastAPI
from fastapi.responses import JSONResponse

app = FastAPI()
state = AgentState(agent)


@app.post("/responses")
async def responses(body: dict = Body(...)) -> JSONResponse:
    run = responses_to_run(body)
    session_id, is_conversation_id = responses_session_id(body)
    response_id = create_response_id()
    session = await state.get_or_create_session(session_id or response_id)
    result = await (await state.get_target()).run(
        run["messages"],
        session=session,
        options=run["options"],
    )
    if is_conversation_id:
        # The app must serialize writers that advance this stable id.
        await state.set_session(session_id, session)
    else:
        await state.set_session(response_id, session)
    conversation_id = session_id if is_conversation_id else None
    return JSONResponse(responses_from_run(result, response_id=response_id, conversation_id=conversation_id))

previous_response_id identifies an immutable continuation snapshot: multiple requests may branch from it and store their results under distinct new response ids. conversation_id is a mutable head instead; only one caller should advance it at a time. These helpers do not provide per-conversation locking.

The base execution-state helpers live in agent-framework-hosting.

Metadata

Release files for agent-framework-hosting-responses 1.0.0a260721

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-framework-hosting-responses 1.0.0a260721
File Size Uploaded Provenance
agent_framework_hosting_responses-1.0.0a260721.tar.gz 11.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-framework-hosting-responses 1.0.0a260721
File Interpreter ABI Platform
agent_framework_hosting_responses-1.0.0a260721-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / agent_framework_hosting_responses-1.0.0a260721.tar.gz

Download URL agent_framework_hosting_responses-1.0.0a260721.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5ee1a784a388d453601bd1577960a5c278e96b60e203ecbd7bbef84a9a59ed9b
BLAKE2b-256 checksum
How to use checksums
f57d515ef30774d3bba5cd2bcc7802377ceea3fadf4a1f09c8dcf63419dc7058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / agent_framework_hosting_responses-1.0.0a260721-py3-none-any.whl

Download URL agent_framework_hosting_responses-1.0.0a260721-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52d9fa9601fe65299f76a758e6f747000a4fa25368c681ee23c3705189f40ee0
BLAKE2b-256 checksum
How to use checksums
caf36314b4e890cb361e4bed237fc714d6c0ae67270f2cedbdf2cd2accfc29c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for agent-framework-hosting-responses 1.0.0a260721

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page