TypeScript & Python SDKs for AI agents
One agent runtime, two first-class SDKs. Define typed tools, stream tokens, wire in memory and multi-agent orchestration, and ship to production with built-in retries and tracing — in the language you already use.
- TypeScript
- Python 3.10+
- Same feature set
The AI agent SDK gives you a small, typed surface for building autonomous agents: create an agent, attach tools, and call run(). Everything else — the reasoning loop, tool-call validation, streaming, and retries — is handled for you.
Whether you write TypeScript or Python, you get the identical agent runtime behind the same clean API. The SDK turns your functions into model-callable tools, manages short- and long-term memory, and runs the perceive → reason → act → observe loop until the goal is met. When you outgrow a single agent, the same primitives compose into multi-agent systems.
This page covers both SDKs side by side: a quickstart in each language, the five steps to install and ship, a feature-parity table, and the building blocks — typed tools, streaming, retries, and tracing — that take an agent from a prototype to production.
Typed agents for your full-stack and edge apps
End-to-end types from tool input to model output. Drop an agent into a Next.js route, a serverless function, or the edge.
Create, add a tool, and run
The TypeScript SDK is fully typed and tree-shakable. Tool arguments are validated against a schema (use Zod or any JSON-schema source), so a typo in a tool call is a compile-time or runtime error — not a silent failure.
- Inferred result types — no any, no casting
- Runs on Node, Bun, and edge runtimes
- First-class async streaming via for-await
1import { Agent, tool } from "@aiagents/sdk"; // typed, tree-shakable2import { z } from "zod";34const getWeather = tool({5 name: "get_weather",6 schema: z.object({ city: z.string() }),7 run: async ({ city }) => fetchWeather(city),8});910const agent = new Agent({11 model: "agentics-pro",12 instructions: "Answer travel questions.",13 tools: [getWeather],14});1516const run = await agent.run("Pack for Lisbon?"); // fully typed result17console.log(run.output);Agents that live next to your data and models
The natural home for ML, data, and research workloads. Decorate a function and it becomes a tool the agent can call.
The same agent, in idiomatic Python
The Python SDK infers each tool's schema from your type hints and docstring, so there's no boilerplate to maintain. It works synchronously for scripts and notebooks, or fully async for high-throughput services.
- @tool decorator infers schema from type hints
- Sync for notebooks, async for services
- Plugs into pandas, NumPy, and your model code
1from aiagents import Agent, tool # pip install aiagents23@tool # schema inferred from hints4def get_weather(city: str) -> dict:5 """Look up current weather."""6 return fetch_weather(city)78agent = Agent(9 model="agentics-pro",10 instructions="Answer travel questions.",11 tools=[get_weather],12)1314run = agent.run("Pack for Lisbon?") # blocking or async15print(run.output)Install & ship in five steps
From an empty project to a deployed agent. The same flow applies to both SDKs — only the install command changes.
1. Install
Add the package with npm or pip. Both SDKs are zero-config and ship full type definitions out of the box.
2. Authenticate
Set your AIAGENTS_API_KEY environment variable. The SDK picks it up automatically — no client wiring required.
3. Define your agent
Create an Agent with a model, instructions, and any defaults. This is the reasoning core that runs the loop.
4. Add tools
Register typed functions as tools. The SDK exposes them to the model via tool calling and validates every argument.
5. Deploy
Ship to a serverless function, container, or the edge. Tracing and retries are on by default in production.
1$ npm install @aiagents/sdk2$ pip install aiagents3$ export AIAGENTS_API_KEY=sk-...Start from a template
Skip the boilerplate: clone a working agent from the templates gallery — support bots, research agents, and RAG pipelines — then swap in your own tools.
TypeScript vs Python: same capabilities
Both SDKs wrap the identical REST runtime, so core features ship together. Choose your language, not a smaller feature set.
| Capability | TypeScript SDK | Python SDK |
|---|---|---|
| Streaming (tokens & events) | ||
| Typed tool calling | ||
| Short & long-term memory | ||
| Multi-agent orchestration | ||
| Built-in retries & backoff | ||
| Tracing & observability hooks | ||
| Edge / serverless runtime | ||
| Notebook (REPL) workflow |
The only honest asymmetries are about where each language runs best: TypeScript shines on the edge and in serverless functions, while Python is unmatched for notebook-driven experimentation. For the full method reference, see the API reference.
SDK features built for production
Everything an agent needs to be reliable, debuggable, and fast — without you writing the plumbing.
Typed end to end
Tool inputs, agent results, and streaming events are all typed. Generics in TypeScript and type hints in Python catch mistakes before they reach production.
Streaming by default
Stream tokens, tool-call events, and reasoning steps over one async iterator. Render partial UI, show live tool status, and cancel mid-run.
Tool decorators & schemas
Turn any function into a tool: the @tool decorator in Python, a schema object in TypeScript. Arguments are validated against JSON schema automatically.
Built-in retries
Transient model and tool failures are retried with exponential backoff and jitter. Set per-tool timeouts and max attempts without touching your loop.
Tracing hooks
Every decision, token, and tool call emits a trace event. Pipe it to your own logger or OpenTelemetry to replay and debug exactly what the agent did.
Local dev mode
Run agents locally with hot reload, mocked tools, and a verbose console. Iterate on prompts and tools fast before you deploy a single line.
First-class SDKs
TS & Python
To first run
install to output
Traceable runs
every step logged
Shared runtime
one REST API
AI agent SDK questions, answered
Pick the language your stack already runs on. The TypeScript SDK is ideal for full-stack and edge apps where the agent lives next to your API routes or serverless functions, with end-to-end types from tool input to model output. The Python SDK is the natural fit for data, ML, and research workloads that already lean on NumPy, pandas, or existing model code. Both SDKs are first-class: they share the same agent runtime, REST API, and feature set, so you can prototype in one and deploy in the other without re-learning the platform.
Docs, references, and starting points
Ship your first agent with the SDK
Install in one command, authenticate, and run an autonomous agent in minutes — free to start, no credit card required.