Embedded agents are agents you invoke from your own application or backend over Phrony’s HTTP API — the same workspace-scoped execution, LLM provider credentials, integrations, and policies as a dashboard session, with your product owning the user journey. That path depends on an API trigger on the agent (and an API key scoped to that agent + trigger).Documentation Index
Fetch the complete documentation index at: https://docs.phrony.com/llms.txt
Use this file to discover all available pages before exploring further.
How you wire it up
- Deploy a version of the agent in the Phrony dashboard so a deployed snapshot is what the platform runs for this line of work.
- Create an API trigger on that agent. Only API triggers get HTTP start URLs; each row carries limits, optional IP allowlists, and the trigger id you bind into API key scopes.
- Create an API key in Settings and give it a scope that includes that agent and that API trigger. The key is a single secret (prefix
phk_) you send on every call. If you need to upload files for runs (see below), turn on Allow file uploads for that key (off by default). - Use the API at https://api.phrony.com (Phrony Cloud’s API host). The agent’s Access tab shows the same base URL plus your
agentIdandtriggerIdfor scoping the API key.
POST /v1/agents/{agentId}/runs the key must match the agentId in the path and the trigger encoded in the key’s scope. For GET /v1/runs/{runId} and optional conversation or stream paths, the same key must still authorize access to that run.
API surface (embedded)
| Step | Method | Path | Purpose |
|---|---|---|---|
| Start a run | POST | /v1/agents/{agentId}/runs | Body: { "input": { ... } } (input is optional). Returns 202 with sessionId, runId, and status. |
| Poll status / result | GET | /v1/runs/{runId} | Status, output, optional error. |
| List sessions (optional) | GET | /v1/agents/{agentId}/sessions?skip=0&take=10 | Paginated sessions for the agent. |
| Conversation / stream (optional) | GET | /v1/runs/{runId}/conversation, /v1/runs/{runId}/stream | Timeline and SSE; same X-API-Key as above. |
| Get upload URL | POST | /v1/file-library/presign | Optional: get a time-limited URL to PUT the file (requires file uploads on the key). |
| Complete upload | POST | /v1/file-library/finalize | Optional: after PUT succeeds, register the file for the workspace. |
X-API-Key: <your phk_ key>. The host is https://api.phrony.com with no extra path prefix before v1 (for example https://api.phrony.com/v1/agents/…).
API redaction (output-only mode)
Sessions started through an API trigger respect the trigger setting Expose step timeline to API clients. It defaults to on, soGET /v1/runs/{runId}/conversation and GET /v1/runs/{runId}/stream can surface the same kind of step-by-step timeline your team sees in the dashboard (within the limits of your key and product behavior).
When that setting is off, Phrony applies redaction to those two external routes only (calls using your X-API-Key):
| Surface | What changes |
|---|---|
GET .../conversation | The payload becomes output-only: timeline items are trimmed to completion-level rows (for example session and root run completed). In that JSON, per-run output, error, and input are cleared, and session-level input and startContext are nulled so prompts and execution metadata are not echoed to API clients. |
GET .../stream (SSE) | Step-detail events, user task / HITL-style events, and similar low-level engine signals are filtered out so clients cannot reconstruct the full trace from the stream. |
GET /v1/runs/{runId} (poll for status and final result) is not rewritten by this redaction path—it returns run fields as implemented for your workspace. If your policy must not expose model output even on that poll, enforce that in your own backend or discuss stricter deployment options with your team.
File uploads with an API key
To attach binary or document inputs stored in your workspace (the same file library as the dashboard), use the/v1/file-library steps below. Uploads are off for a key until you enable Allow file uploads in Settings → API keys (create or edit the key). If uploads are not enabled, POST /v1/file-library/* returns 403.
Flow:
POST /v1/file-library/presignwith JSON:filename,mediaType, andmaxContentLength(bytes — the most this upload is allowed to be; your plan’s storage limit is checked here). The response includesobjectKey,uploadUrl,httpMethod(PUT),requiredHeaders, andexpiresInSeconds.PUTthe file bytes touploadUrlusing exactly therequiredHeadersfrom the response (includingContent-Typeand encryption headers). For browser or fetch uploads, do not require a fixedContent-Lengthin the signed request.POST /v1/file-library/finalizewithobjectKeyfrom step 1, the samemaxContentLength, and optionalfilename/mediaTypefor labels in the file library.- Start a run with
POST /v1/agents/{agentId}/runsand pass a file ininputwhere your agent expects it. Use the shape below: setfilenameto the file name only from the upload (the part after the last/inobjectKey— for examplea1b2c3d4-e5f6-7890-abcd-ef1234567890.pdf), not a full path. ThephronyFilefield marks the object as a stored file for the runtime:
filename to the file in your workspace before the run runs. In input you normally send only filename and mediaType as shown; you do not need to pass long storage paths from the client.
Use the same X-API-Key for presign, finalize, and POST /v1/agents/{agentId}/runs. Your plan’s file-storage limits apply the same as in the product UI.
Examples
Use https://api.phrony.com as the base URL, or the base URL your team uses for self-hosted or staging. GetAGENT_ID and the trigger to scope your key from the agent’s API trigger → Access tab; create PHRONY_API_KEY under Settings. After you start a run, take runId from the JSON response to poll. Each tab shows the same flow: start a run, then poll by runId.
input (plain object) — match the shape to your deployed agent version input contract (schema or ad hoc keys).