Integrating the SDK
Connect any channel — a web UI, Zendesk, Slack, an IVR — to a running agent with the InteractiveAI Python SDK: sessions, messages, both event delivery modes, handover, and production patterns.
1. Install
pip install "interactiveai[agent]"2. Construct the client
import asyncio
from interactiveai.agent import InteractiveAgentClient
async def main() -> None:
async with InteractiveAgentClient(
base_url="https://my-agent.example.com",
api_key="<AGENT_API_KEY>",
) as client:
sess = await client.sessions.open(id="customer-1")
await sess.post_user_message("Hello!")
asyncio.run(main())3. Open a session
4. Post a user message
5. Receive replies — pick a delivery mode
Mode
Use when
Polling — stream events with sess.events()
sess.events()Webhook — let the agent push events to you
6. Know your events
Event
Meaning
Status events drive your UI
Status
Meaning
7. Replay history when a UI reconnects
8. Human handover
9. Handle errors
Exception
When
10. Minimal end-to-end
Common patterns
Resume a UI session from a cookie
Route an inbound third-party webhook into a session
Find an existing session by an external id
Push context into the conversation mid-flight
Render tool calls in the UI
Tune the event stream
Parameter
Default
What it does
Production notes
SDK surface map
Entry point
Used for
Last updated
Was this helpful?

