CortiClient
The root client. You create one instance and pass it to every resource client. It handles authentication, base URL resolution, and theTenant-Name and A2A-Version headers automatically.
The resource clients above are available in the TypeScript SDK. The Python SDK currently provides
AgentsClient only; additional resource clients will be added in the v2 rebuild.client.raw property: the underlying openapi-fetch client for direct API access when you need an endpoint the SDK does not wrap yet.
Agents
An agent is a reusable unit of behaviour: a name, a description, a system prompt, and a set of tools (connectors). You create agents via the agents resource client, which returns typedAgentHandle objects.
Create an agent
Fetching and listing
Updating
Only the fields you pass are sent. Passingconnectors replaces the full set.
AgentHandle
AnAgentHandle wraps an agent response and provides conversation helpers. In TypeScript, client.agents.create() returns a raw Agent object; you wrap it explicitly. In Python, AgentsClient.create() returns an AgentHandle directly.
Lifecycle: ephemeral vs persistent
Agents default toephemeral, which means the server cleans them up automatically. Use persistent only when the agent must survive process restarts.
Lifecycle controls the agent definition (system prompt, connectors). Conversation threads (
AgentContext) are always managed automatically regardless of lifecycle. You never need to create or delete threads manually.Contexts and conversations
AnAgentContext represents a single conversation thread. Contexts are lazy: no network call is made until the first message is sent, at which point the server creates the thread and returns a contextId that the SDK tracks automatically.
Multi-turn conversation
You do not need to manage context IDs yourself. Keep the context object in memory across turns. Only persist
ctx.id if you need to resume the exact same thread after a process restart, and use handle.getContext(id) to do so.One-shot helper
No context object needed for single-shot invocations:Resuming a thread across sessions
If you need to continue a thread after a process restart, persistctx.id (only available after the first turn) and use handle.getContext(id) / agent.get_context(id) next time.
AgentContext yourself or pass IDs to createContext().
sendText vs sendMessage vs streamMessage
All three live onAgentContext and send to the same thread (the contextId is shared). The only differences are the input shape and whether the response is buffered or streamed.
sendText is a convenience wrapper for sendMessage:
sendMessage over sendText:
streamMessage returns events incrementally; sendMessage waits for completed or failed and returns the final aggregate. Streaming has no buffered MessageResponse: assemble the text yourself by concatenating event.message.parts.
Connectors
Connector factories build typed connector definitions. You declare connectors at agent creation time in theconnectors array. The agent can call them autonomously when its prompt suggests doing so.
The
schema connector type is new in v2 and currently available in the TypeScript package only. The Python package will add it in the v2 rebuild.Registry connectors
Typical registry connectors include:
To see what connectors are available in your tenant, browse the registry connector reference.
Building a clinical orchestrator
Use multiple connectors together to build a well-rounded clinical orchestrator:MessageResponse
Every non-streaming call returns aMessageResponse that promotes the fields you most often need to the top level.
Streaming
Streaming responses arrive as an async generator ofStreamEvent objects. Each event is one of task, message, statusUpdate, or artifactUpdate.
streamMessage tracks the same contextId as sendMessage. You can freely mix streaming and non-streaming calls on a single context.
Connector auth
In the TypeScript v2 SDK, connector auth is configured on the connector itself at agent creation time, not forwarded as credentials at call time. Use theauth factory to specify the auth type:
CredentialStore passed to create_context(). The credential key must match the connector’s name: