Skip to content
OpenEightDeveloper docs
Docs / Agent runtime / Calls and sessions
SDK integration

Calls and sessions

Choose when to open a session and how to manage resources across calls.

On this pageWhen do you need a session?Who closes each resource?Invocation and batch

When do you need a session?

A session keeps SDK resources open while your Agent works. If you pass a checkpointer or a resources factory, open a session with with agent or async with agent before the first call, even for a single request.

Choose the call lifetime for your application
Your taskWhat to useWhy
One request or batch without a checkpointer or resources factoryinvoke/batch, or await ainvoke/abatchAutomatic temporary session and cleanup.
Long-lived serviceOne explicit session for the service lifespanReuse SDK resources across requests.
Incremental resultsExplicit session plus stream/astreamKeep resources open until the stream closes.
Conversation with saved stateExplicit session plus thread and checkpointerRead the same authorized conversation state on later calls.
Important

Choose Sync for a synchronous script and Async inside an existing event loop. Use the same mode throughout a session. Inside a running event loop, await the async methods and avoid nesting asyncio.run.

Keep a session open across requests

Use your configured model, tools and openeight_config. The example processes your requests in one session. In a web service, open the session at startup and close it at shutdown.

Set up the connection first →

PythonSeveral requests · explicit session
from openeight.langchain import create_agent

agent = create_agent(
    model=model,
    tools=tools,
    openeight=openeight_config,
)

with agent:
    for inputs in requests:
        result = agent.invoke(inputs)
        process_result(result)

Each request produces its own Run. Exiting the context closes the session.

Who closes each resource?

The SDK closes resources it creates, such as transport and delivery workers. Your application keeps ownership of models, backends and savers passed directly to the agent, so keep them alive until agent cleanup finishes. If you use resources=, create and close any checkpointer or store in that factory and omit both constructor arguments. Pass your model directly.

Invocation and batch

Each new input starts its own Run. Keep resources open until the Agent finishes processing the inputs it has accepted.

Concurrency and batch failures

Open a sync Agent session once and make one call at a time. The SDK rejects nested sessions and overlapping calls on that Agent. For concurrent requests, use a separate sync Agent per thread or make async calls on the event loop where you opened the Agent.

Calls on the same checkpoint thread must run sequentially. If a batch fails early, the Agent finishes handling inputs it already accepted before it can take another call.

Need help choosing an agent lifetime?

Tell us how your Agent handles requests and when it needs to release resources. Keep credentials and private application data out of your message.

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.