Nodofi Docs

Agentic Studio and Tool-Calling Guide

Complete setup and usage guide for the Agentic pane in Studio, including worker orchestration, tool contracts, cancellation behavior, and practical prompt patterns.

Overview

Agentic mode lets Studio run multi-step plans through a relay-connected orchestrator worker. Instead of one-shot model responses, the agent can choose tools, observe outputs, iterate, and return a final answer with an execution trace.

Two user entry points exist:

  1. Agentic pane in Studio (dedicated run/stop panel with trace viewer).
  2. Assistant -> Run as Agentic in chat, using the same backend route.

Runtime architecture

Studio browser
  -> POST /api/agentic/run (authenticated)
    -> server/agentic.js bridge
      -> relay message to AgenticStarter worker
        -> planner (Ollama)
        -> tool workers (http, memory, registry, filesystem, clouddb)
      <- answer + per-step trace
  <- JSON response for UI

The server route is a relay bridge and guardrail layer. Tool execution and planning happen in the external workers.

Prerequisites

RequirementWhy
Studio running and signed inAgentic API route requires authenticated session.
Relay URLAll worker communication is relay request/reply.
AgenticStarter worker onlineHandles function: agent.run requests.
Ollama reachablePlanner calls /api/chat for step planning.
Tool workers onlineAgent actions depend on target workers (http/memory/etc).

Worker setup

1. Prepare agentic starter

cd agentic-starter
npm install
cp .env.example .env

2. Set core variables

RELAY_URL=https://relay.yourdomain.com
AGENT_NAME=AgenticStarter
OLLAMA_HOST=http://127.0.0.1:11434
OLLAMA_MODEL=qwen2.5:7b
AGENT_MAX_STEPS=6
AGENT_PLAN_RETRIES=2
AGENT_TOOL_RETRIES=2

3. Start workers

# terminal 1
npm run start:tool:memory

# terminal 2
npm run start:tool:http

# terminal 3
npm run start:tool:registry

# terminal 4
npm run start:tool:filesystem

# terminal 5
npm run start:tool:clouddb

# terminal 6
npm run start:agent
Tip: You can run a smaller stack while testing specific tools. For example, if your goal only needs memory + HTTP, keep those workers up first and add more as needed.

Studio pane workflow

  1. Open the Agentic pane in Studio.
  2. Set Relay URL and Agent name (default agent name is AgenticStarter).
  3. Set max steps (UI enforces 1 to 12).
  4. Optionally keep Include current editor context enabled to pass file/selection/problems context.
  5. Write goal and click Run goal.

The response renders as:

  • Answer: final agent text.
  • Trace: per-step thoughts, actions, and observations.

Pane context payload (automatic)

{
  "source": "studio-agentic-pane",
  "at": "2026-10-02T12:34:56.000Z",
  "editor": {
    "openFile": {"name":"...","type":"...","content":"..."},
    "files": [...],
    "selection": "...",
    "errors": [...],
    "problems": [...]
  }
}

Assistant workflow (Run as Agentic)

From Assistant chat, the Run as Agentic button sends the current prompt through the same API route. While running, the button switches to Stop Agentic. On cancellation it shows Agentic run stopped.

This is useful when you want to keep conversational history in Assistant while still invoking tool-calling for selected prompts.

API contract

Request: POST /api/agentic/run

{
  "relay": "https://relay.yourdomain.com",
  "agent": "AgenticStarter",
  "goal": "Find latest Node LTS and save it to memory",
  "maxSteps": 6,
  "context": {"source":"manual-api-call"}
}

Response (success)

{
  "ok": true,
  "answer": "Latest LTS is ... and was saved.",
  "trace": [
    {
      "step": 1,
      "thought": "Need current release info.",
      "actions": [{"tool":"http.request","args":{"url":"..."}}],
      "observations": [{"tool":"http.request","ok":true,"output":{...}}]
    }
  ]
}

Server validation and limits

FieldRule
goalRequired, cleaned text, max 8000 chars.
relayRequired http(s) URL.
agentRegex ^[A-Za-z0-9_-]{1,128}$.
maxStepsClamped to 1..12.
contextJSON object only, max 200000 chars after stringify.
Rate limit120 requests/hour per signed-in user.

Tool-calling details

The orchestrator recognizes these tool names by default:

Tool namePurpose
http.requestExternal/internal HTTP calls.
memory.list/get/set/deletePersistent agent memory KV operations.
registry.search/packageNodofi package registry lookup.
filesystem.list/read/write/append/deleteRoot-scoped file operations.
clouddb.callForward operations to CloudDB worker over relay.

Example action shape

{
  "tool": "memory.set",
  "args": {
    "namespace": "research",
    "key": "latest_node_lts",
    "value": "v22.x"
  }
}
Important: Tool execution depends on worker availability. If a mapped worker is offline, steps will record failed observations and the agent may fall back or fail.

Goal templates and examples

Research + cache pattern

Find the latest Node.js LTS release from official sources. Save it in memory namespace "release_cache" key "node_lts" and return a 3-line summary.

Workspace file synthesis pattern

Read docs/setup.md and docs/api.md, then write a concise onboarding note to docs/quick-onboarding.md with sections: prerequisites, first run, gotchas.

CloudDB operational pattern

Using clouddb.call, list rows from project 0123... table tasks where status=todo limit 20, then produce a markdown sprint checklist.

Constrained safe prompt pattern

Do not call filesystem.write or filesystem.delete. Only use filesystem.read and memory.* tools. Analyze the release notes and summarize upgrade risks.

Stop/cancel semantics

What happens when user clicks Stop

  1. Browser aborts fetch for /api/agentic/run.
  2. Server detects request close and aborts relay wait.
  3. Server sends relay message {"function":"agent.cancel","runId":"..."}.
  4. Orchestrator looks up active run by runId and aborts its controller.
  5. Planner/tool loops stop at next abort check; in-flight relay asks that honor signals are cancelled.

User-visible outcomes

  • Agentic pane: status becomes Agent run stopped.
  • Assistant flow: message bubble becomes Agentic run stopped.

Cancellation is cooperative. If a specific external operation is not abort-aware, stop takes effect at the next checkpoint.

Trace interpretation

Each trace step contains these parts:

FieldMeaning
thoughtShort model rationale for current step.
actionsTool calls selected by planner.
observationsTool results or errors returned to planner.
final (optional)Final answer text when done in that step.

Debug approach: identify first step where ok: false appears, then inspect worker availability, arguments, and connectivity.

Troubleshooting

SymptomLikely causeFix
"relay must be an http(s) URL"Invalid relay inputUse full URL including protocol.
"agent must be 1-128..."Name has unsupported charsUse letters, numbers, underscore, dash only.
"The agent did not answer in time."Worker offline / model stalledCheck agent logs, relay connectivity, Ollama reachability.
Frequent step failures in traceOne or more tool workers downStart missing workers and retry.
429 rate limit errorExceeded hourly capWait until request window clears or reduce automation burst.
Stop pressed but still running brieflyCooperative cancellation checkpoint delayExpected; watch for next step boundary termination.

Safety and limits

  • Do not expose privileged filesystem roots to agent workers unless strictly needed.
  • Use least-privilege worker credentials for registry/CloudDB environments.
  • Treat memory namespace data as untrusted input when reused in future runs.
  • For production, add explicit allowlists for outbound HTTP domains if possible.
  • Keep goal prompts bounded and explicit to reduce unintended tool actions.
Recommendation: Start with read-only goals (http + memory.get + filesystem.read), then gradually enable write/delete tools once team workflows are stable.