Skip to navigation

How Rasen works

From an API key to a finished call, with the operations and objects of each step.

Summary

This page shows each step from an API key to a finished call, with its operations and objects. It also gives the states of an agent. It does not give the requests of each step; each step links the guide that does.

Facts

ItemValue
AuthenticationAuthorization: Bearer <key>. The key selects its workspace
MutationsIdempotency-Key on each write; If-Match with the current ETag on each edit
What a call runsThe agent’s live version at admission. Draft edits never change a call
Agent state valuesdraft, live, paused, archived. Open vocabulary
Archive window14 days from archived_at to archive_deadline, then permanent deletion
IDsOpaque strings of at most 128 characters

The flow

  1. Get a workspace and an API key. A member of the workspace creates the key in the Rasen app, on the Developers page under API keys. The API has no operation that creates a workspace or a key. Check the key with getContext. See Authentication and Quickstart.
  2. Create an agent. createAgent creates the agent in state draft, with its first draft. Edit the draft with updateAgentDraft, pick a voice with listVoices and set variables with setAgentVariable. See Build and publish an agent.
  3. Add knowledge, tools and credentials. Add sources with createKnowledgeSource, uploadKnowledgeSource or createAgentKnowledgeSource, and link them with addAgentKnowledgeSource. Add webhook tools with createAgentTool, and MCP servers with createMcpServer and discoverMcpTools. Store tool credentials with createSecret. See Add knowledge to an agent, Add tools and MCP servers, Store and rotate tool credentials and Add a before-call tool.
  4. Validate and publish. validateAgentDraft checks the draft, with an optional patch, and saves nothing. publishAgent freezes the complete draft into a version and makes it live in one step. The agent is then live. rollbackAgent makes an earlier version live again. See Build and publish an agent.
  5. Test in the browser. setAgentShareLink issues a link that runs the live version in a browser, with no phone number and no carrier. rotateAgentShareLink replaces it. See Share a test-call link.
  6. Connect a carrier account or a SIP trunk. createTelephonyConnection stores the credentials of a carrier account. connectSipTrunk, createSipInboundConnection and createSipOutboundTrunk set up a SIP trunk. See Connect a carrier account and Connect a SIP trunk.
  7. Import a number. listAvailablePhoneNumbers and importPhoneNumbers import numbers of a carrier account. importSipNumber imports a number of a SIP trunk. See Connect a carrier account and Connect a SIP trunk.
  8. Route the number to the agent. setPhoneNumberInboundAgent makes the agent answer the number. addPhoneNumberOutboundAgent lets the agent call from it. provisionPhoneNumber retries the carrier setup of an inbound number. See Route phone numbers to agents and Configure call transfers.
  9. Calls happen. An inbound call to a routed number needs no operation. createCall places an outbound call. createAgentSession runs the agent on a call leg that you own. Campaigns call a list: createCampaign or uploadCampaign, then planCampaign, admitCampaign and startCampaign. See Place calls and read results, Run an outbound campaign, Call lifecycle and Campaign lifecycle.
  10. Read the results. getCall gives the call’s state and the readiness of each result. Read the results with getCallTranscript, getCallSummary, getCallExtraction, downloadCallRecording and listCallToolOutcomes. Follow a live call with streamLiveCallTranscript. See Place calls and read results, Follow a call’s transcript live and Read tool call logs.
  11. Receive webhooks. createWebhookEndpoint subscribes an HTTPS endpoint to call.completed, call.failed, call.analyzed and tool.failed. See Receive call events with webhooks and Webhook events.
  12. Measure usage. listUsage and queryUsage give the quantities of each component, for each agent or call. See Measure usage.

Objects

Each ID is opaque: never parse it or build one. The prefix of the contract examples helps you read logs.

ObjectWhat it isID prefix
WorkspaceThe container of agents, numbers, calls and keys. A key belongs to one workspace.ws_
API keyThe bearer credential of one workspace. You manage keys in the Rasen app.key_
AgentA voice agent: its identity, its draft, its versions and its state.agent_
DraftThe editable configuration of an agent: prompt, voice, settings, variables and tools. One for each agent.None. Read it at /agents/{agent_id}/draft; its revision is its ETag
VersionAn immutable published configuration. Calls run the live version.pub_
ToolA webhook tool of an agent, or a tool from an MCP server.tool_
MCP serverA registered MCP server whose tools agents can use.mcp_
SecretA write-only credential for tools and MCP servers, with immutable versions.sec_
Knowledge sourceA web page, text or document that an agent answers from.kb_
Telephony connectionThe stored credentials of a carrier account.None in the contract examples
Phone numberA number imported from a carrier account or a SIP trunk.number_
CallOne call: inbound, outbound, an agent session or a browser test.call_
CampaignA list of recipients that one agent calls. The same ID is the batch_id of the exports.None in the contract examples
Webhook endpointAn HTTPS URL that receives call and tool events.wep_
Share linkA bearer link to test the live version in a browser. One for each agent.None. Read it at /agents/{agent_id}/share-link

Agent lifecycle

stateMeaningCalls
draftThe agent was never published.Refused. Publish the agent first.
liveThe agent has a live version.Admitted. Each call runs the live version.
pausedThe agent keeps its configuration and history.Refused with agent_not_live.
archivedThe agent is in its 14-day archive window. Rasen refuses draft edits, publish and rollback with agent_archived.Refused with agent_not_live.
FromToCause
NonedraftcreateAgent
draftlivepublishAgent
livelivepublishAgent with a new version, or rollbackAgent to an earlier version
Any statepausedNo API operation sets paused.
draft, live or pausedarchivedarchiveAgent. It refuses with archive_blocked while a call, a campaign or other work of the agent runs.
archivedThe state before the archiveunarchiveAgent, before archive_deadline
archivedDeleted: reads answer 404 not_foundarchive_deadline, 14 days after archived_at. Running work or a legal hold can delay the deletion, never bring it forward.
createAgent publishAgent publishAgent or rollbackAgent archiveAgent archiveAgent archiveAgent unarchiveAgent unarchiveAgent unarchiveAgent archive_deadline passes draft live archived paused

Rules

  • MUST publish an agent before it takes calls. A draft edit never changes a call.
  • MUST NOT parse an ID or build one from a prefix.
  • MUST send a new Idempotency-Key with each write, and the current ETag in If-Match with each edit.
  • MUST keep an unknown state value of any object, and never read it as success.
  • MUST unarchive an agent before its archive_deadline to keep it.