Service SDKs and CLI
Install the Service 0.9 SDKs for Python, TypeScript, Go, and Rust. Run agents, stream results, execute client tools, and upload files.
Use an official SDK to call a managed agent from your application. Service executes the agent and saves the conversation. The examples on this page target Service and SDK version 0.9.0.
Choose a client
Install the SDK in your application project. Python requires 3.13 or newer; Go requires 1.25 or newer. In a new Go project, run go mod init example.com/my-app before go get. Add the Rust dependencies to Cargo.toml.
python -m pip install 'a13n==0.9.0'Connect to your deployment
Open Connect to app in Console to find your agent and create a workspace API key. Set these values in the environment where your app runs:
| Variable | Value |
|---|---|
A13N_SERVICE_URL | Deployment base URL, for example https://service.example.com, without /api/v1. |
A13N_API_KEY | Workspace API key, supplied to your backend through its secret manager. |
A13N_AGENT | Existing agent ID in the key's workspace; the example code reads this value. |
The key selects its workspace. Browser applications can use a login session with workspace selection and CSRF; keep workspace API keys on the server.
Invoke an agent
Send a message and inspect the saved run. In Go, paste the example into func main() and import context, fmt, log, os, and a13n "github.com/converge-ai-labs/a13n-sdk-go". Run the TypeScript example as an ES module on Node.js.
import asyncio
import os
from a13n import Client
async def main():
async with Client() as client:
run = await client.agents(os.environ["A13N_AGENT"]).run("Say hello.")
print(run.status, run.text)
asyncio.run(main())Check the run status before using its output: completed has the finished result; waiting needs an approval or client-tool response; failed and cancelled end the execution. Save the thread ID for follow-ups and the run ID to find the execution in Console.
Stream output and read a resource
Use streaming for a live preview and read the final run for its saved output. Resource collections also provide typed access to Service data. For example, inside the Python client context:
agent = client.agents(os.environ["A13N_AGENT"])
async with agent.stream("Write a short greeting.") as stream:
async for chunk in stream.text_stream:
print(chunk, end="", flush=True)
run = await stream.result()
thread = await client.threads(run.thread_id).get()
print("\n", thread.id, run.status)| SDK | Open a preview, then get the saved run | Read an existing thread |
|---|---|---|
| Python | agent.stream(prompt) → await stream.result() | await client.threads(thread_id).get() |
| TypeScript | agent.stream(prompt) → await stream.result() | await client.threads(threadId).get() |
| Go | agent.Stream(ctx, a13n.Text(prompt)) → stream.Result(ctx) | client.Threads.Handle(threadID).Get(ctx) |
| Rust | agent.stream(prompt).await? → stream.result().await? | client.threads().handle(thread_id).get().await? |
Closing a preview ends local observation. To stop the remote execution, cancel the run.
Run client tools
Declare each client tool in the agent configuration, then explicitly opt into local execution from your application. The SDK dispatches the registered handlers and follows the successor run. For example, with a blocking format_title tool that takes a string named title:
run = await agent.run_tools(
"Use format_title to format 'welcome home'.",
tools={"format_title": lambda title: title.title()},
)The corresponding methods in TypeScript, Go, and Rust are runTools, RunTools, and run_tools. A plain run or stream leaves tool handling to the application. For asynchronous tools, use the thread's retained tool executions.
Upload a file
The upload helper creates a workspace asset that you can pass with a message. For example, with notes.txt in the working directory:
asset = await client.assets.upload("notes.txt")
run = await agent.run(["Summarize these notes.", asset])In TypeScript, pass bytes and a filename to client.assets.upload(bytes, { filename: "notes.txt" }). In Go, pass an a13n.UploadFile to client.Assets.Upload(ctx, file). In Rust, use client.assets().upload("notes.txt").await?. Uploading requires workspace write access. See Assets for the underlying HTTP workflow.
Keep version ownership clear
SDKs and the remote CLI release independently of Service. When upgrading, compare the SDK's target Service contract with your deployment version and use the guide for the SDK release you install.
- SDK application guides for 0.9.0: Python, TypeScript, Go, and Rust.
- For shell scripts and API exploration, see the separate
a13n-service-cliproject. Thea13n-servicecommand operates the server. - For direct integration, see HTTP conventions and the API reference.