Suede AI Agent StudioDocsStart buildingOpen workspace
Navigation menu

Developers4 min readUpdated

Build agents in TypeScript with the Suede AI SDK and CLI

Quick answer

Install @suedeai/agents from npm, define your agent with defineAgent in an agent.ts file, and run suede push to publish it as a live Agent Studio endpoint. The SDK gives every agent a metered model through suede.llm, key-value memory, schedules and webhook triggers. No model API keys required.

What you'll have

  • An agent.ts that runs on your machine with suede dev and live with suede push
  • A trigger setup that matches the job: schedule, manual, webhook or paid call
  • The environment variables for offline development, live gateway calls and relay hosting
On this page
  1. How do I install the Suede AI SDK?
  2. What does an agent look like in code?
  3. Which triggers can start a code agent?
  4. Which CLI commands does Agent Studio support?
  5. How do I develop and self-host an agent?
  6. Which environment variables does the SDK read?
  7. Questions

How do I install the Suede AI SDK?#

Run one npm install. The package ships the SDK and the suede command, written in TypeScript with full type definitions, and it pulls in no model SDKs: Agent Studio provides the model.

Install and scaffold a projectshell
npm install @suedeai/agents
npx suede init          # writes agent.ts, package.json, .gitignore and .suede/config.json
npx suede login <key>   # your workspace key from the Workspace page

From install to live endpoint

0 of 5 done

  1. Step 1: Copy your workspace key

    Open Workspace, click Reveal under This key is your workspace., then Copy.
    Open Workspace
  2. Step 2: Install and scaffold

    Run npm install @suedeai/agents, then npx suede init in an empty folder.
  3. Step 3: Log in

    Run npx suede login {key}. The CLI verifies the key and saves it to .suede/config.json.
  4. Step 4: Run it locally

    Set SUEDE_GATEWAY_STUB=1 and run npx suede dev, then POST to localhost:3001/run.
  5. Step 5: Push it live

    Run npx suede push. The CLI prints your slug and live URL, and the agent appears in Workspace.
    See it in Workspace

What does an agent look like in code?#

An agent is a name, a list of triggers and an async run function. defineAgent validates the definition and freezes it, so a bad cron string or an empty trigger list fails on your machine instead of in production.

agent.tstypescript
import { defineAgent, schedule, manual, suede } from "@suedeai/agents";

export default defineAgent({
  name: "price-watcher",
  description: "Reads a product page excerpt, remembers the price, flags a drop.",
  triggers: [schedule("0 13 * * *"), manual()],
  async run({ input, memory }) {
    const out = await suede.llm({
      system: "Extract the price as a number.",
      prompt: String(input ?? ""),
    });
    const last = await memory.get<number>("lastPrice");
    await memory.set("lastPrice", Number(out.text));
    return { price: out.text, dropped: last !== undefined && Number(out.text) < last };
  },
});
  • suede.llm({ system, prompt }) calls the Agent Studio model gateway and returns { text }, billed to your usage credit.
  • suede.run(nodeType, config) calls any Agent Studio node from code and returns { output }.
  • memory.get and memory.set keep state between runs; locally they write to .suede/memory.json.
  • A gateway failure throws a typed GatewayError whose status is 401 (bad key), 402 (out of credit) or 429 (rate limited).

Which triggers can start a code agent?#

Four trigger helpers cover every way work arrives. Combine them freely: one agent can run on a schedule and on demand.

SDK triggers
HelperStarts a run whenNotes
schedule(cron)The cron time arrivesFive-field cron in UTC, validated at define time
manual()You or your code calls itRun from Workspace or the run endpoint
webhook()A signed request reaches the agentPairs with signed webhooks and the relay
paidCall(price)A buyer pays per callOptional; see Sell your agent per call

Which CLI commands does Agent Studio support?#

The suede CLI
CommandWhat it does
suede initScaffolds agent.ts, package.json, .gitignore and .suede/config.json
suede login {key}Verifies and saves your workspace key
suede pushPublishes agent.ts and prints the slug and live URL
suede pull {slug}Writes manifest.json and agent.ts from a published agent
suede devServes the agent on port 3001: POST /run and GET /manifest
suede versions list {flowId}Lists immutable published versions
suede versions pull {flowId} {id}Pulls one version to your machine
suede versions inspect {flowId} {id}Shows a version's hashes and pins
suede versions export {flowId} {id}Exports a self-hostable bundle of that version
suede link {slug} --url {url}Routes calls for a published agent to your own server
suede whoamiPrints the API URL and your key prefix

How do I develop and self-host an agent?#

Set SUEDE_GATEWAY_STUB=1 and suede.llm echoes your prompt with no network call and no key, so you iterate offline at zero cost. When you want your own box to do the work, serve(agent, { port }) starts a plain Node HTTP server with the same POST /run and GET /manifest routes.

Run offline, then call itshell
SUEDE_GATEWAY_STUB=1 npx suede dev

curl -X POST http://localhost:3001/run \
  -H 'content-type: application/json' \
  -d '{ "input": "Widget Pro, now $89" }'

Which environment variables does the SDK read?#

SDK environment variables
VariablePurpose
SUEDE_WORKSPACE_KEYAuthenticates live gateway calls
SUEDE_GATEWAY_STUB=1Offline echo mode: no HTTP, no key
SUEDE_API_URLOverrides the platform URL (default https://agents.suedeai.ai)
SUEDE_RELAY_SECRETAuthenticates relay-forwarded calls inside serve()

Prefer a canvas?

Every template opens on the visual builder too, with free dry runs on every step.

Questions buyers ask#

Is the Suede AI SDK on npm?

Yes. Install it with npm install @suedeai/agents. The same package ships the suede command, so npx suede init works right after install.

Do I need an OpenAI or Anthropic API key to use the SDK?

No. suede.llm calls the Agent Studio model gateway with your workspace key and bills your usage credit. For offline work, SUEDE_GATEWAY_STUB=1 echoes prompts with no key and no network call.

Can I run my agent on my own server?

Yes. serve(agent, { port }) runs it on any Node host, and suede link {slug} --url {url} routes calls for the published Agent Studio endpoint to that server with a relay secret.

What time zone do SDK schedules use?

UTC. schedule("0 13 * * *") runs daily at 13:00 UTC, and defineAgent rejects a malformed cron expression before anything ships.

Can I pull an agent built on the canvas into code?

Yes. suede pull {slug} writes manifest.json and agent.ts, and suede versions export produces a self-hostable bundle of any immutable version.

Was this page helpful?

Good work starts with a clear flow.

Give an agent a job. Connect the steps. See how the work becomes a service someone else can call.

Input
Reason
Output

A workflow you can inspect

Make the steps visible.

Start with a template or describe the job. Connect inputs, reasoning, and output on the canvas.

Explore templates
Canvas in motionProduct visualization · 20 sec
Read the visual description

A stylized organization chart opens into a workflow canvas. Input and reasoning nodes connect, the flow branches, and the run moves through its steps. The film ends with Suede AI Agent Studio. Music only; no spoken narration.