Skip to main content

pushary-openai-agents

Human-in-the-loop for the OpenAI Agents SDK (Python). A function tool that asks a real human to approve, delivered to their phone, and blocks on a fail-closed answer.

Requires the Pushary Partner plan.

Install

pip install pushary-openai-agents

Set PUSHARY_API_KEY (get it in your dashboard).

Connect a phone once

from pushary_openai_agents import connect

link = connect("user_123")  # show this to your end-user; one tap connects their phone

The tool

from agents import Agent, Runner
from pushary_openai_agents import pushary_tool

agent = Agent(
    name="Support",
    instructions="Call ask_human before issuing any refund.",
    tools=[pushary_tool("user_123")],
)
result = await Runner.run(agent, "Refund order 5?")

When the model calls the tool, Pushary delivers the question to that user's phone and the call blocks until they answer. The tool returns a fail-closed instruction. The external_id is bound when you build the tool, never taken from the model, so a prompt-injected agent cannot ask the wrong person.

Durable approvals

For a wait longer than a request can hold, drive your own flow off ask_human with a callback_url on decisions.create and resolve the signed callback:

from pushary_openai_agents import resolve_pushary_callback, SIGNATURE_HEADER

def callback(request):
    cb = resolve_pushary_callback(request.body, request.headers.get(SIGNATURE_HEADER), SECRET)
    if not cb:
        return ("bad signature", 401)
    # look up your parked run by cb["correlationId"], approve/reject, resume
    return ("ok", 200)

For TypeScript, use npm i @pushary/openai-agents.

API

  • connect(external_id, *, api_key=None, base_url=None) — enroll an end-user's phone.
  • pushary_tool(external_id, *, name="ask_human", ...) — an OpenAI Agents function tool bound to that user.
  • ask_human(question, *, external_id, type="confirm", ...) — blocking, returns the decision dict.
  • resolve_pushary_callback(raw_body, signature, secret) — verify + parse a callback for the durable path.
  • describe_answer(type, result), is_affirmative(answer), deterministic_key(parts), SIGNATURE_HEADER.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pushary_openai_agents-0.1.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

pushary_openai_agents-0.1.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pushary_openai_agents-0.1.2.tar.gz.

File metadata

  • Download URL: pushary_openai_agents-0.1.2.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pushary_openai_agents-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6a86a8ec3874010e8d0be8e18ae3d216a701d8a4c3f58f01bceeccb597494dfe
MD5 24db6c1a734579fb320249c2a50fb39b
BLAKE2b-256 948d204f43a43e7cc127d78385ce4135c16150b7c9343e6cb85bc27c6705446e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pushary_openai_agents-0.1.2.tar.gz:

Publisher: release-pypi.yml on aadilghani1/pushary

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

File details

Details for the file pushary_openai_agents-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pushary_openai_agents-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7bfd06a8be01539032cd800c800e33bbc7ca2aeeedded296beb986f2b40d70db
MD5 99c074e4c7e827d9cc5e3f729182a1ee
BLAKE2b-256 e03785938dc67e20c06bae1ff179c571d54c6f2bad678ea2d79488533e7c774f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pushary_openai_agents-0.1.2-py3-none-any.whl:

Publisher: release-pypi.yml on aadilghani1/pushary

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 Sentry Error logging StatusPage Status page