Skip to content
OpenEightDeveloper docs
Docs / SDK reference / Approval waiting and replay
SDK integration

Approval waiting and replay

A managed Agent can wait in the running process or return a waiting thread for your code to resume. With a direct Python client, your code polls and replays the request.

On this pageWait for approval with a managed AgentReplay an approved request with a direct Python clientRecover after a process restart

Wait for approval with a managed Agent

During an in-process wait, LangChain and Deep Agents pause the tool call when a Decision requires approval. The SDK polls for the reviewer’s decision and replays the original request after approval. The tool can run only after successful revalidation.

Approval polling defaults
SettingDefaultPurpose
timeout3,600 secondsMaximum local wait
poll_interval0.5 secondsInitial poll interval
poll_backoff_multiplier2Interval growth between polls
poll_max_interval5 secondsMaximum polling interval before jitter
poll_jitter0.1Random variation of up to 10% in either direction
Note

timeout limits how long the Agent waits locally. The request has its own expiry in the Console and may still be pending when the local wait ends. When the wait ends on timeout, rejection or expiry, the tool does not run. A later approval cannot restart a timed-out call. The default on_block="message" returns an error tool message. With on_block="raise", the SDK raises ApprovalTimeout on timeout or BlockedError on rejection or expiry.

To change the local wait, pass ApprovalConfig when creating your Agent.

Pythonapproval_config.py
import os
from openeight import OpenEightConfig
from openeight.langchain import ApprovalConfig

openeight_config = OpenEightConfig(
    agent_name=os.environ["OPENEIGHT_AGENT_NAME"],
    endpoint=os.environ["OPENEIGHT_ENDPOINT"],
    credential=os.environ["OPENEIGHT_API_KEY"],
    approval=ApprovalConfig(timeout=120.0),  # Wait up to two minutes instead of one hour.
)
# Pass openeight_config to create_agent or create_deep_agent.

Expected result · This Agent waits up to two minutes for review.

Review an approval request in the Console →

Replay an approved request with a direct Python client

Your code owns the wait. Before calling client.decide, snapshot the full tool arguments and save the exact request, including the Run ID, Decision ID, tool version, source time, policy digest and selected values.

  1. Check that the response matches the original Run and Decision IDs. An initial allow authorizes this attempt. For approval_required, set a local deadline. Before each poll, calculate the time remaining and pass it to client.approval_state(decision_id, timeout=remaining). Stop when the deadline passes.
  2. After observing approved, recalculate the remaining time. If time remains, replay the saved request with client.decide(**request, timeout=remaining). Check that both IDs match, replayed is true and the verdict is allow or approval_required. The recorded Decision can retain its original verdict after approval.
  3. Check the deadline once more before calling the handler with the saved arguments. On rejection, expiry, timeout, a mismatched response or failed revalidation, stop. If the outcome is uncertain, reconcile the original attempt before retrying.

See the Python authorization and replay helper →

Recover after a process restart

If a durable Agent returned waiting, reopen it with the same durable state after restart. Once the reviewer responds, call resume(thread_id=thread_id, command_id=command_id) or aresume with the original thread ID and a new command ID for the resume operation. Reuse that command ID if you retry the same operation.

Configure durable recovery before starting the Run. It requires persistent storage, exclusive access to the thread and a way to check whether the destination already executed the tool. An in-process wait ends when the process exits.

For LangChain durable model and schema settings, use an immutable DurableApprovalConfig.deployment_binding with bind_deployment or abind_deployment.

For Deep Agents, finish outstanding format-1 approvals with their original runtime, artifact, configuration and credential. Start format-2 deployments with fresh state. Credential rotation or rebinding requires a migration.

Troubleshoot an approved action that did not run →

OpenEight / Developer docsPython SDK 0.0.1

Search documentation

Build with OpenEightBuild or connect an agent, configure its controls, and inspect its activity.
Build your first agentDefine a model and tools, create an agent with OpenEight, configure policies, and run it.
Connect an existing agentKeep your existing model, tools, and agent logic. Add the OpenEight Python SDK where your agent calls tools so a policy can allow a call, block it, or pause it for approval.
Refund walkthroughSee how OpenEight checks a refund before the tool runs. USD refunds through $100 can proceed. Larger USD refunds and refunds in other currencies wait for a reviewer. All receipts in this walkthrough are simulated.
Integrate LangChainConnect your existing LangChain agent to OpenEight and verify its first governed tool call.
Integrate Deep AgentsConnect your existing Deep Agents agent to OpenEight and verify its first governed tool call.
Custom integrationsUse OpenEight with an Agent that calls tools directly or uses another framework.
Observe without enforcementConnect your Agent’s OpenTelemetry exporter to see Runs and tool activity in OpenEight. Tool calls proceed without policy checks or approval requests.
How governance worksBefore your Agent runs a governed tool, OpenEight checks the request against its active policies.
Prepare tools for governanceCheck how OpenEight classifies your Agent’s tools and confirm the intent Assist will use to draft policies.
Create policies with AssistAssist drafts rules and test cases from a policy intent. Review what the rules allow, deny or hold for approval before activating them.
Handle approvalsReview a pending tool call and decide whether the Agent may continue.
Inspect decisionsSee how your policies applied to a tool call and find out whether it executed.
Inspect runs and eventsOpen a Run to see which tools your Agent called, how long they took, and what status the Agent reported.
Configure model pricingModel rates apply across every Workspace in your organization. OpenEight uses them to calculate spend from recorded usage.
Set Agent budgetsSet cost and token limits for an Agent.
Send approval notifications to SlackSend approval requests to a Slack channel so reviewers can open them in the OpenEight Console.
Export and verify evidenceExport a Workspace evidence bundle, establish trust in its signing key, and verify recorded evidence offline with the OpenEight CLI.
TroubleshootingDiagnose SDK startup, tool publication, approval, and delivery issues.
Calls and sessionsChoose when to open a session and how to manage resources across calls.
Stream results and clean upRead incremental agent results and release resources when a reader stops early.
Threads and checkpointsSave a conversation between calls so your Agent can pick up where it left off.
Delivery and shutdown checksFlush buffered work and inspect delivery before shutdown.
Compatibility and installationFind your integration, supported runtime and SDK version.
ConfigurationConfigure connection settings, approval waiting and content capture.
Constructors and executionCreate an agent and choose its invocation methods.
LangChain optionsLook up structured output, configurable models and LangChain execution limits.
Deep Agents optionsConfigure root and child tools, filesystem permissions and MCP sources.
Tool publication and readinessPublish tool schemas, find acknowledged versions and check policy readiness.
Approval waiting and replayA managed Agent can wait in the running process or return a waiting thread for your code to resume. With a direct Python client, your code polls and replays the request.
Python API signaturesLook up parameters, defaults and return types for OpenEight Python SDK 0.0.1.