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.
Embed in Existing Service
Add agent capabilities to an Express app you already have — without restructuring your codebase.Use
agent.start() instead. It handles everything internally.Why Embed?
You have an existing service — maybe an API, a webhook handler, or a background worker. You want to add AI capabilities without:- Rewriting your application structure
- Running a separate agent process
- Managing two deployments
attach() lets you keep your existing Express app and add agent capabilities as a layer on top.
Quick Start
What attach() Does
One call wires up everything:
- A2A endpoints — Mounts
/.well-known/agent-card.json(agent discovery) and/send(capability invocation) on your Express app - Mesh registration — Authenticates with the mesh, registers your agent’s capabilities, and starts heartbeating to stay discoverable
- Triggers — Activates triggers already registered on the agent via
agent.add_triggers() - Graceful shutdown — Listens for
SIGTERMandSIGINTto disconnect cleanly before your process exits
Attach Configuration
AttachConfig
An Agent instance with capabilities already defined. Create with
new Agent(\{ name, description, public_url? \}).Mesh connection credentials. If omitted, the agent runs locally without mesh registration — useful for development and testing.
Triggers
Triggers let external events fire prompts into the mesh. When a trigger fires, the prompt template is filled with payload data and sent to the mesh for processing.Webhook Triggers
Receive HTTP POST requests from external systems and convert them into mesh prompts. Use this to integrate with Zendesk, Stripe, GitHub, Slack, or any system that sends webhooks.WebhookTrigger
Trigger type identifier. Must be
"webhook".Event name for logging and identification. Example:
"ticket_created".URL path where the webhook will be mounted. External systems POST to this endpoint. Example:
"/webhooks/zendesk".Prompt template sent to the mesh. Use double-brace placeholders for dynamic values. Example:
"New ticket \"subject\" (ID: ticket_id). Triage it.".Maps payload fields to prompt variables using JSONPath dot-notation.
/webhooks/zendesk, the payload_map extracts ticket.id and ticket.subject from the JSON body, fills them into the prompt, and sends it to the mesh.
Schedule Triggers
Run prompts on a cron schedule. Use this for daily summaries, periodic checks, or scheduled maintenance tasks.ScheduleTrigger
Trigger type identifier. Must be
"schedule".Event name for logging and identification. Example:
"daily_summary".Cron expression (5 fields: minute hour day-of-month month day-of-week). Example:
"0 9 * * MON-FRI".Prompt sent to the mesh when the schedule fires. Example:
"Summarize all open tickets and send to Slack.".0 9 * * *— Every day at 9:00 AM0 9 * * MON-FRI— Weekdays at 9:00 AM*/15 * * * *— Every 15 minutes0 0 1 * *— First day of every month at midnight
Emit Triggers
Listen for in-process events fired by your own application code. Use this when your app detects something that needs AI handling — like an SLA warning, a fraud signal, or a customer escalation.EmitTrigger
Trigger type identifier. Must be
"emit".Event name. Your code fires this event using handle.emit(). Example:
"sla_warning".Prompt template sent to the mesh. Use double-brace placeholders. Example:
"Ticket ticket_id is approaching SLA breach. Take action.".The AgentHandle
attach() returns an AgentHandle for runtime interaction with the mesh.
AgentHandle
Fire-and-forget: emit an event that triggers a prompt to the mesh. Does not wait for a response. Signature:
(event: string, payload: object) => void.Request-response: emit an event and wait for the mesh to process it. Returns the result. Times out after 30 seconds. Signature:
(event: string, payload: object) => Promise<unknown>.Clean shutdown: stops cron timers, removes event listeners, disconnects from mesh, and closes the agent. Call this before your process exits. Signature:
() => Promise<void>.The underlying MeshConnector instance, or null if mesh config was omitted. Use to check connection status or access advanced mesh features.
The underlying Agent instance.
Full Example
An Express service with existing routes, agent capabilities, and multiple trigger types:When to Use This
| Scenario | Recommendation |
|---|---|
| Adding AI capabilities to an existing Express app | Use attach() |
| Need webhook or cron triggers | Use attach() |
| Want fire-and-forget or request-response patterns | Use attach() |
| Building a new standalone agent | Use agent.start() |
| Need full control over connection lifecycle | Use manual agent.expose(app) + MeshConnector |
| Local development without mesh | Omit mesh config — agent runs standalone |
attach() is a convenience wrapper. Under the hood it calls agent.expose(app) and creates a MeshConnector — the same primitives you’d use manually.
What’s Next
- Connecting Agents — Discover and call other agents
- Telemetry — Traces, spans, and observability
- Write Your Agent — Build a standalone agent from scratch
