EvoStudio Docs

Agent API

Two ways to call your EvoStudio agent from outside the browser — install the Agent package for a conversational experience inside your own AI engine, or call the REST API directly from any app or script.

1

Use via the Agent package

The Chraft Agent Caller is a ready-made agent workspace you can install directly into your EvoStudio instance. Once installed, you can chat with it in plain language — tell it what to ask your agent, it builds the API call, streams the reply back, and manages multi-turn sessions automatically.

skill-chraft-agent-caller

Skill

Claude / Cursor Skill Package · v20260426-1 · SKILL.md format

Download .zip

Or paste this prompt into your Claude Code / Cursor chat — it will download, unzip, and place the skill in the right folder for you:

Install the Chraft Agent Caller skill for me. Download the zip from https://cdn.chraft.ai/skills/skill-chraft-agent-caller-20260426-1.zip, unzip it, and move the chraft-agent-caller folder into ~/.claude/skills/ (Claude Code) or .cursor/skills/ in this project (Cursor). Then verify the SKILL.md is in place.

Manual install: unzip into ~/.claude/skills/ (Claude Code) or your project's .cursor/skills/ folder (Cursor). The skill auto-loads on relevant prompts — no install command needed.

workspace-chraft-agent-caller

Chraft Agent Package · v20260426-1 · 10 KB

Download .zip

Paste this into your EvoStudio chat to install in one shot — it points to the latest signed CDN URL:

install agent https://cdn.chraft.ai/agents/workspace-chraft-agent-caller-20260426-1.zip

Or download the zip and drag-and-drop it into the EvoStudio chat window.

Setup — API key required

This agent requires an External API key to function.

The agent calls Chraft's REST API on your behalf. Without a valid sk-oc-* key it will return a 401 error on every request.

  1. 1Go to EvoStudio → Instance and scroll to External API Keys.
  2. 2Click Create Key — copy the sk-oc-… key immediately (it is shown only once).
  3. 3Install the agent package, then in the first message provide your key and base URL:
My API key is sk-oc-abc123... and my app URL is https://chraft.ai

The agent saves both to session memory and reuses them for every subsequent call.

What the agent can do

CapabilityDescription
Single-turn callSend a message, get the full reply in one go
Streaming callStream the reply token-by-token as it arrives (default)
Multi-turn sessionsPersist sessionKey across turns for conversation continuity
Error diagnosis401 / 402 / 503 explained in plain language with recovery steps
Session resetSay "new session" to start a fresh conversation
or
2

Use via the REST API

Call the API directly from any app, script, or backend. Two endpoints — one for a single JSON response, one for real-time streaming.

Prerequisites

1. A running EvoStudio instance — Deploy one from the Instance page.

2. An API key — Create one in the External API Keys panel. Keys look like sk-oc-… and are shown only once at creation.

Authentication

Include your API key as a Bearer token in every request:

Authorization: Bearer sk-oc-<your-key>

POST /api/evostudio/chat — single response

Send a message and receive the complete reply in one JSON response. Best for scripts and server-side calls.

Request body

{
  "message":    "string (required)",
  "sessionKey": "string (optional) — omit to start a fresh session",
  "history": [
    { "role": "user" | "assistant" | "system", "content": "string" }
  ]
}

Success response 200

{
  "success":    true,
  "reply":      "The agent's text response",
  "sessionKey": "your-session-key-or-null",
  "usage": {
    "prompt_tokens":     120,
    "completion_tokens": 45,
    "total_tokens":      165
  }
}

Error responses

StatuserrorCause
400message is requiredMissing or empty message
401UnauthorizedMissing, invalid, or expired API key
402Insufficient creditsCredit balance too low
503EvoStudio instance not configuredInstance not running

Example — curl

curl -X POST https://your-app.com/api/evostudio/chat \
  -H "Authorization: Bearer sk-oc-abc123..." \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello, what can you do?", "sessionKey": "sess-001"}'

Example — Node.js

const res = await fetch('/api/evostudio/chat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk-oc-abc123...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ message: 'Hello!', sessionKey: 'sess-001' }),
});
const { reply } = await res.json();

Example — Python

import requests

resp = requests.post(
    "https://your-app.com/api/evostudio/chat",
    headers={"Authorization": "Bearer sk-oc-abc123..."},
    json={"message": "Hello!", "sessionKey": "sess-001"},
)
print(resp.json()["reply"])

POST /api/evostudio/chat/stream — SSE streaming

Same request body as above. Returns a text/event-stream response that streams tokens as they arrive.

Event types

EventPayloadDescription
delta{"text": "…"}Partial text chunk
done{"text": "…", "sessionKey": "…", "usage": {…}}Full reply + session info
error{"error": "…"}Error — stream closed immediately after

Example — curl

curl -N -X POST https://your-app.com/api/evostudio/chat/stream \
  -H "Authorization: Bearer sk-oc-abc123..." \
  -H "Content-Type: application/json" \
  -d '{"message": "Write a haiku about AI"}'

Example — browser fetch

const res = await fetch('/api/evostudio/chat/stream', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk-oc-abc123...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ message: 'Tell me a story' }),
});

const reader = res.body!.getReader();
const decoder = new TextDecoder();
let buffer = '';

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  buffer += decoder.decode(value, { stream: true });
  const lines = buffer.split('\n');
  buffer = lines.pop() ?? '';
  let event = '';
  for (const line of lines) {
    if (line.startsWith('event:')) event = line.slice(6).trim();
    else if (line.startsWith('data:')) {
      const payload = JSON.parse(line.slice(5).trim());
      if (event === 'delta') process.stdout.write(payload.text);
    }
  }
}

Session management

Pass the same sessionKey across multiple requests to maintain conversation context. Omit it (or use a new value) to start a fresh session. Sessions are scoped to the workspace that owns the API key.

Which endpoint to use?

Use caseEndpoint
Server-side script / automation/api/evostudio/chat
Simple one-shot queries/api/evostudio/chat
Real-time UI showing tokens as they arrive/api/evostudio/chat/stream
Long-running generation tasks/api/evostudio/chat/stream