Skip to main content

Expose an agent and call it from outside

Every agent in your workspace can be run from the app — and, when you choose to, from outside it. Exposing an agent lets your own systems and trusted partners trigger it directly: a claims system that needs a governed decision, a partner portal that submits work overnight, a script on a schedule you control. Every external call is a governed run — it goes through the same governance checks, returns the same verdict, and, when its answer is recorded, leaves the same downloadable Verification Record (Sealed by Velerian) as a run started in the app.

How external access works

Exposure is per agent, and it's off by default. When you turn it on, Velerian issues an access key that works only for that one agent. It can read that agent's description, start its runs (with the documents they work on), check on them and the workflows they start, share them, download their evidence, and take the case actions built for API callers on that agent's own cases. It can't reach another agent's cases, runs or documents, even by naming them in a call, and it can't do anything else in your workspace. You stay in control: turning exposure off shuts down every key for that agent immediately.

Turn it on in the app

  1. Open the agent's detail page and find the External access card. (You'll need to be a workspace administrator or owner — other members don't see the card.)
  2. Choose Allow external access. A confirmation dialog spells out exactly what you're agreeing to: outside systems will be able to trigger this agent with the issued key, and every call is a governed run.
  3. Confirm. You get the agent's call endpoint, the new access key, and a ready-to-paste curl command.
Copy the key now — it is shown exactly once. Velerian keeps only a fingerprint of it, so it can never be shown again. If you lose it, use Issue another key (or turn access off and on again) to get a new one.

Turn it on from the API

If you'd rather script it, the same action is one call, authenticated as a signed-in administrator (your session token, not an access key):

curl -X POST "https://app.velerian.ai/api/v2/networks/your-agent/expose" \
  -H "Authorization: Bearer <your admin session token>" \
  -H "Content-Type: application/json" \
  -d '{"acknowledge": true}'

acknowledge: true is required — it records the same explicit consent the dashboard dialog captures; without it the call returns 400 and nothing changes. The response is the only place the key's secret ever appears:

FieldWhat it is
endpointThe path outside callers POST to (prepend https://app.velerian.ai)
secretThe full access key (vk_live_...) — shown exactly once, store it now
key_prefixThe key's public identifier, for recognizing it in the key list later
scopesWhat the key can do: start this agent's runs, read run status, read evidence
confirmed_ack_atWhen your consent was recorded

You can check an agent's exposure state any time with GET /api/v2/networks/your-agent/exposure — it returns the on/off state and key metadata, never secret material.

Call the agent

An outside system calls the agent with the key as a bearer token:

curl -X POST "https://app.velerian.ai/api/agenticx/networks/your-agent/invoke" \
  -H "Authorization: Bearer vk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt_text": "Your request for this agent"}'

The response is a complete governed run:

FieldWhat it is
run_idThis run's id — use it to re-read the run (GET /api/v2/pack-runs/{run_id}), revise it, share it, or download its evidence
run_urlThe run's page in the app, ready to open in a browser or paste into a ticket
output_textThe work product
governance_passThe governance verdict — whether the run cleared its checks
governance_reasonsThe reasons, when the verdict flags something
evidence_download_urlA time-limited download link for this run's Verification Record
model_id_usedThe model that produced the output

Long-running work: call it asynchronously

Add ?async=true and the call returns immediately with 202 Accepted, a run_id, a poll_url, and the same run_url — the id and the link mean the same thing on both the synchronous and the asynchronous path:

curl -X POST "https://app.velerian.ai/api/agenticx/networks/your-agent/invoke?async=true" \
  -H "Authorization: Bearer vk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt_text": "Your request for this agent"}'

Then poll GET https://app.velerian.ai/api/v2/pack-runs/{run_id} until the status is terminal (succeeded or failed) — the finished run carries the same output, verdict, and evidence as the synchronous response. The same key covers the whole loop: it can start runs, poll them, and download their evidence, so an external caller never needs a second credential.

One key, one agent

The key is deliberately narrow:

  • It works only for the agent it was issued for. Point it at any other agent — or at any other part of the API that needs a credential — and the call fails with 403 and the error code pack_scope_violation. The response names the agent the key is restricted to (restricted_to) and, when the call named a different agent, that one too (requested), so a misrouted integration is easy to diagnose. A call that names another agent's case, run or document (a case_id, case_ref, parent_run_id or attachment_ids entry on a run, say) fails the same way, and that response doesn't say which agent the item belongs to. Workspace administration refuses every API key, this one included, with api_key_not_allowed.
  • Turning exposure off revokes every key for that agent instantly. From that moment, calls fail with 401 and the error code invalid_api_key. There is no propagation delay.
  • Exposing again mints an additional key. Use Issue another key (or send the expose call again) to hand different partners their own keys — each is recognizable by its prefix, and all of them stop working together when you turn access off.

When your governance policy says no

Your workspace's governance policy can forbid exposing some or all agents. When it does, the dashboard shows the action disabled with the policy's reason, and the API returns a structured 403 carrying the same reason — the "why" is always explicit, never a silent failure.

The policy also governs every call made with an API key or a machine token, not only turning access on. While it forbids exposing an agent, a call made with any key that starts that agent's work (running it, opening a case on it, or starting, resuming or restarting its workflow) fails with 403 and the error code exposure_denied_by_policy, carrying the policy's reason. That includes an access key issued for the agent before the policy changed, and a workspace-wide key. Each refused call is recorded in your workspace's audit log. People signed in to the app can still run the agent there.

Billing and governance, unchanged

An external call is a governed run like any other: it counts in your usage, it's evaluated against the agent's governance posture, and, when its answer is recorded, it produces a downloadable Verification Record (Sealed by Velerian). See Governance & Verification Records and Agreement & billing.

Want broader, workspace-level API access with the official Python and TypeScript SDKs instead? Start with the developer quickstart.