Skip to main content
This guide walks you through deploying an agent for one of your customers, sending it a message, and streaming its responses in real time.

Core concepts

ConceptDescription
DeploymentA dedicated AI agent for one customer: model, system prompt, skills, MCP tools, and connectors, running in an isolated container with a persistent filesystem
ThreadA conversation with a deployment’s agent. Every deployment starts with a default thread
RunOne unit of agent work, triggered by a message or an automation
EventsThe SSE stream of tokens, tool calls, status updates, and steering requests from the deployment

Prerequisites

  • A Herm API key
Herm is in early access, so you can’t create a key yourself yet — book a call and a Prism team member will provision one for your team. Keys are shown once, so store yours in your secret manager.

Install the SDK

bun add herm
Set your API key as an environment variable — the SDK picks it up automatically:
export PRISM_API_KEY="your-api-key-here"
import Herm from "herm";

const herm = new Herm(); // reads PRISM_API_KEY
1

Create a deployment

Create an agent for a customer with your system prompt. This is the minimal version — see Deployments for skills, MCP servers, connector secrets, and feature flags.
const deployment = await herm.deployments.create({
  customer_id: "cus_quickstart",
  name: "Quickstart Agent",
  system_prompt:
    "You are a helpful media generation agent. Help the user plan, create, and iterate on short-form videos.",
});

console.log(deployment.deployment_id, deployment.status);
The response includes everything you need for the next steps:
{
  "deployment_id": "dep_7xK9s2",
  "customer_id": "cus_quickstart",
  "runtime": "hermes",
  "status": "ready",
  "model": "anthropic/claude-sonnet-4.5",
  "thread_id": "thr_default_8a1",
  "filesystem": {
    "workspace_path": "/workspace",
    "persistent": true
  },
  "events": {
    "transport": "sse",
    "url": "https://api.prismagents.com/v1/deployments/dep_7xK9s2/events"
  }
}
Save deployment_id — you’ll reference it in every request that follows.
2

Wait for the deployment to be ready

Provisioning usually completes in seconds. If status is provisioning, poll Get a deployment until it flips to ready:
while ((await herm.deployments.get(deployment.deployment_id)).status !== "ready") {
  await new Promise((resolve) => setTimeout(resolve, 1_000));
}
3

Open the event stream

Open the SSE stream first so you catch every event from the run you’re about to start:
const stream = await herm.deployments.events.stream(deployment.deployment_id);
If the connection drops, the SDK reconnects automatically and resumes from the last received event — see Stream Events.
4

Send your first message

Post a message to the deployment. Omitting thread_id uses the default thread from step 1:
const run = await herm.deployments.messages.send(deployment.deployment_id, {
  content:
    "Write a shot-by-shot storyboard for a 30-second product demo video and save it to storyboard.md",
});

console.log(run.run_id, run.status); // "run_4mPx81", "running"
5

Watch the agent work

Back on the event stream, tokens, tool calls, and status updates arrive as the agent works:
for await (const event of stream) {
  switch (event.type) {
    case "token":
      process.stdout.write(event.delta);
      break;
    case "tool_call":
      console.log(`\n[Using tool: ${event.tool}]`);
      break;
    case "run_status":
      if (event.status === "completed") {
        console.log("\n\nAgent finished.");
      }
      break;
  }
}
I'll draft the storyboard scene by scene
[Using tool: write_file]

Agent finished.
The agent wrote storyboard.md to its persistent workspace — it’ll still be there next session, along with everything the agent learned about this customer.

What’s happening

When you send a message, Herm:
  1. Routes it to the customer’s agent: every deployment is its own Hermes instance in its own container.
  2. Runs the agent loop: the model reasons, calls tools, observes results, and repeats until the task is done.
  3. Executes tools in the sandbox: file writes, shell commands, and your MCP tools run inside the deployment’s container.
  4. Streams events: you receive tokens, tool calls, and status changes in real time over SSE.
  5. Remembers: the workspace and observational memory persist, so the next run starts where this one left off.

Next steps

Deployments

Add skills, MCP servers, connector secrets, and feature flags.

Send Message

Threads, attachments, and image & video input.

Stream Events

Event types, steering requests, and reconnection.

Errors

Error codes and recovery steps.