Documentation Index
Fetch the complete documentation index at: https://docs.svantic.com/llms.txt
Use this file to discover all available pages before exploring further.
Agent
What it is
Agent is the main class in the SDK. An Agent bundles three things:
- Identity — a name, description, type, and instance id that together become the agent’s public card.
- Capabilities — the functions this agent makes callable over A2A (see
define_capability). - Runtime — an HTTP server or an outbound WebSocket, plus the Svantic registration / heartbeat machinery and automatic telemetry.
Agent is also optionally smart: pass instructions and llm to let it reason about natural-language tasks and call its own capabilities as tools. Without those, it’s a deterministic tool server — capabilities are invoked directly.
When to use it
Every Svantic agent you build starts withnew Agent(...). Reach for it when you want to:
- Expose structured capabilities an LLM or another agent can invoke.
- Run a smart agent that plans its own work.
- Bridge MCP servers into the platform.
- Embed an agent into a service you already run.
RemoteAgent instead.
Functional usage
The typical lifecycle:- Every capability invocation is automatically wrapped in a telemetry span, visible in the dashboard’s Traces tab. See Telemetry.
- When the caller had an active trace, its W3C trace context is parsed and surfaced to your handler on
CapabilitySessionContext, so outbound HTTP calls can continue the same trace. See Trace propagation.
Constructor
AgentConfig is documented in full in Types. The most common shape:
Methods
define_capability(config)
Register a capability. Must be called before start() or expose().
handler receives (args, context):
args— the parsed parameters, validated against the JSON Schema.context— aCapabilitySessionContextwithsession_id,tenant_id, and W3C trace-propagation fields.
CapabilityConfig for the full option surface.
register_mcp(server_name, config, options?)
Spawn an MCP server as a child process and register each of its tools as a capability on this agent.
server_name— logical name used as the capability prefix (hyphens become underscores, sochrome-devtools→ capabilities namedchrome_devtools_<tool>).config—McpServerSpawnConfig:{ command, args?, env? }.options.tool_prefix— override the default prefix.
start() / expose().
See the MCP integration guide.
start()
- Connected mode (default) — opens an outbound WebSocket to Svantic. No HTTP server is started, no port is opened. Requires
meshcredentials onAgentConfig. - Hosted mode — when
public_urlorportis set onAgentConfig, starts an Express server onport(or an ephemeral port) and mounts/send+/.well-known/agent-card.json.
expose(app, endpoint_path?)
MeshConnector to register with Svantic.
Adds two routes:
/.well-known/agent-card.json— agent card discovery/send(or the path you pass) — JSON-RPC 2.0 A2A endpoint
stop()
close(). Safe to call even if the agent was never started.
close()
stop(); call close() directly only when you’re managing the HTTP server and mesh connection yourself (e.g. in tests or when using expose(app) + a standalone MeshConnector).
set_context(context)
Merge values into the agent’s live context. Context is surfaced on the agent card and used by the platform for context-aware routing.
Properties
| Property | Type | Description |
|---|---|---|
name | string | The agent’s display name. |
description | string | What the agent does. |
public_url | string | Public HTTPS URL (hosted mode); empty string for connected mode. |
agent_type | string | Logical agent type used for mesh routing. |
instance_id | string | Unique id for this running instance. |
version | string | Agent version (defaults to '1.0.0'). |
capabilities | Map<string, CapabilityConfig> | Registered capabilities, keyed by name. |
context | Record<string, unknown> | Current live context. |
instructions | string | undefined | System prompt (smart agent mode). |
llm_config | LlmConfig | undefined | LLM configuration (smart agent mode). |
is_smart_agent | boolean | true when both instructions and llm are set. |
Telemetry is not owned by theAgentanymore — it flows through the global OpenTelemetryTracerProvider. Usetrace.getTracer(...)from@opentelemetry/apito add custom spans. See Telemetry.
Helper methods
build_agent_card()
Returns the A2A agent card produced from the agent’s current configuration and registered capabilities. Useful for inspection and testing.
See also
AgentConfig— the full constructor option shape.CapabilityConfig— whatdefine_capabilityaccepts.- Defining capabilities — task-oriented walkthrough.
- Connecting to Svantic — connected vs. hosted modes.
