On this page
- Request
- Message
- EnvironmentSpec
- CredentialBinding
- ProfileMount
- CompletionCall
- RenewalCall
- OrganizationLayer
- ContentPart
- RepositorySpec
- LeaseNetwork
- LeaseBudget
- OrganizationSkill
- FileRef
- Response
- AgentSession
- SessionEvent
- AgentRun
- ResourceMeta
- SessionUsage
- EnvironmentSpec
- CredentialBinding
- ProfileMount
- OrganizationLayer
- StepUsage
- Message
- ToolCall
- ToolResult
- Approval
- StatusChange
- FileChange
- TurnResult
- ErrorEvent
- SandboxActivity
- AgentSessionWait
- SessionWaitContinuation
- RepositorySpec
- LeaseNetwork
- LeaseBudget
- OrganizationSkill
- ContentPart
- TurnTokenUsage
- Errors
- Examples
Run an agent
Atomically admits a pinned task session, initial event and pending turn.
Atomically admits a pinned task session, initial event and pending turn.
- Path
POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/agents/agent:run - Scope
agents:sessions - Effect
write— a successful call changes state. - Collection agents
Request
| Field | Type | What it is |
|---|---|---|
name | string | The name of the agent to run under the caller's environment grant. Required. |
agent_version | string | The immutable agent version pinned for this task attempt. Required. |
agent_session_id | string | The stable session identifier; reusing it for another attempt is refused. Required. |
message | Message | The initial task message appended atomically with session acceptance. Required. |
environment | EnvironmentSpec | Optional overrides of the environment in the pinned AgentVersion's frozen spec, never the Agent's current head. Omitted or empty with no mask keeps that default unchanged. Only selected fields are overlaid; see environment_mask. The effective environment must have a supported shape, finite positive TTL and valid repository, network and budget before admission. |
credentials | map<string, CredentialBinding> | Captured credential bindings by alias; credentials never enter context. |
profiles | ProfileMount[] | Granted profile mounts for the fresh session lease. |
completion | CompletionCall | The pinned tool call used by the runtime to deliver the terminal result. Required. |
workspace_knowledge | struct | Opaque, claim-pinned workspace knowledge, including its rendered instruction. |
task_ref | string | Caller-owned opaque reference, not interpreted by Agents. |
renewal | RenewalCall | Optional pinned grant-renewal call, owned by the runtime after acceptance. |
runtime_credential_handle | string | Same-session handle to a caller-owned scoped Access credential. Runtime only, never installed in the guest or sent to the model. Required. Never returned again. |
environment_mask | field_mask | Fields of environment to overlay, relative to EnvironmentSpec, using proto snake_case paths such as ttl, repo.uri, repo.revision, egress.allowed_domains and budget.max_cost_micros. The wire value is a comma-separated string; SDK property naming does not change these paths. Omitted or empty infers populated serialized leaf fields recursively, preserving unselected siblings from the pinned version. Proto defaults (including empty lists) need an explicit mask to reset a selected field. Selected lists replace, rather than append to, the inherited list. The sole path "*" replaces the whole environment, resetting unpopulated fields. Unknown, invalid and output-only paths are rejected, as is a nonempty mask without environment. Effective validation also applies to explicit resets and whole-environment replacement. |
item_key | string | The caller's stable identity of the work item, not interpreted otherwise. Every session and attempt with the same item key works on one repository branch derived from it, so a new attempt continues the pushed work. Omitted, the session is the item. |
owner_pool | string | The OwnerPool this run owns work for. Admission refuses with INVALID_STATE unless agent_version is a QUALIFIED member at that moment; later turns of the session are not re-checked. |
verifies | string[] | The maker sessions this run verifies, 1 to 16; empty for an ordinary run. Admission refuses with PERMISSION_DENIED unless agent_version is read-only and its Agent differs from every maker session's Agent. The verifier session never receives a maker transcript. Set at most one of owner_pool and verifies. |
organization_layer | OrganizationLayer | The organization layer the caller binds at assignment, read from its own versioned store. The session pins it; see AgentSession.organization_layer. |
room | string | Immutable Room of this attempt, workspaces/{workspace}/rooms/{room}. A Room-bound call requires an environment grant restricted to both this exact Room and the addressed Agent. Omit for non-Room tasks. |
artifact_refs | string[] | Opaque, already-authorized references to artifacts for the Room output. The workspace engine owns artifact authorization and publication. |
Message
| Field | Type | What it is |
|---|---|---|
parts | ContentPart[] | The content, in order; 1 to 64 parts. Required. |
EnvironmentSpec
| Field | Type | What it is |
|---|---|---|
shape | string | A Sylphx Sandboxes shape; empty gives sessions no environment. |
idle_standby | duration | Put the environment in standby after this long idle, 1m to 24h; default 10m. |
template | string | The Sandboxes image: template:<name> or an artifact image by digest, passed unchanged to the lease's image field. |
repo | RepositorySpec | The repository to prepare inside the fresh lease, if any. |
egress | LeaseNetwork | The lease's outbound policy, using the Sandboxes network contract. |
budget | LeaseBudget | The lease's CPU and cost ceiling, separate from model and tool spend. |
ttl | duration | The lease's maximum wall time, passed to Sandboxes as ttl. The lease is released when the session ends even if this bound has not been reached. |
CredentialBinding
| Field | Type | What it is |
|---|---|---|
secret | string | A Kernel Secret of this environment, by name. One of the source group. |
connection | string | A Kernel Connection (a third-party OAuth installation), by name. One of the source group. |
end_user_provider | string | The end user's own grant in Sylphx Auth's agent token vault, by provider id; the session's end user must hold it. One of the source group. |
placement | string | How the value is sent: bearer (default), header:<Name> or query:<name>. |
handle | string | An opaque credential handle issued for this session, resolved only at egress. This is never a credential value. Never returned again. One of the source group. |
ProfileMount
| Field | Type | What it is |
|---|---|---|
name | string | orgs/{org}/projects/{project}/envs/{env}/profiles/{profile}. Required. |
mode | string | read_only (default) or write_back. Only a write_back grant saves changes at session end while its lease still answers; empty is read_only. |
CompletionCall
| Field | Type | What it is |
|---|---|---|
tool | string | The authorized tool name in the pinned agent version. Required. |
arguments | struct | Immutable literal tool input, excluding credentials and mapped result fields. |
result_fields | map<string, ResultField> | Destination argument names mapped to runtime-produced result selectors. |
RenewalCall
| Field | Type | What it is |
|---|---|---|
tool | string | The authorized renewal tool name in the pinned agent version. Required. |
arguments | struct | Immutable literal renewal-tool input, with credential injection by the gateway. |
interval | duration | Positive interval, from five seconds to five minutes. Required. |
cancel_field | string | JSON pointers into the tool response; no domain-specific field names. |
reason_field | string | A response JSON pointer selecting the cancellation reason. |
credential_updates | map<string, string> | Credential binding alias to a response JSON pointer for its replacement. |
credential_expiries | map<string, string> | Matching aliases to issuer-returned RFC3339 expiry response pointers. |
idempotency_argument | string | Top-level argument receiving a stable per-tick runtime idempotency key. Omit this argument from literal input; retries reuse it, later ticks change it. |
OrganizationLayer
| Field | Type | What it is |
|---|---|---|
instructions | string | Always loaded organization instructions, at most 256 KiB. |
skills | OrganizationSkill[] | Up to 256 skills with unique names; the layer is at most 1 MiB in total. |
ContentPart
| Field | Type | What it is |
|---|---|---|
text | string | Text. One of the part group. |
file | FileRef | A file, by Sylphx Data object URL or an https URL. One of the part group. |
RepositorySpec
| Field | Type | What it is |
|---|---|---|
uri | string | The repository URI. Access uses the session's bound credential handles. Required. |
revision | string | The commit or ref to check out; empty uses the repository's default branch. |
LeaseNetwork
| Field | Type | What it is |
|---|---|---|
egress | EgressPolicy | Default ALLOW. One of allow, deny, allowlist. |
allowed_domains | string[] | Hosts reachable when egress is ALLOWLIST: exact names or one leading *. wildcard label, for example api.openai.com, *.github.com. |
allowed_cidrs | string[] | Public CIDRs reachable when egress is ALLOWLIST. |
LeaseBudget
| Field | Type | What it is |
|---|---|---|
max_cpu_seconds | int64 | End CPU_BUDGET after this many vCPU-seconds of guest CPU time. |
max_cost_micros | int64 | End COST_BUDGET once the shape's list price times wall seconds reaches this many millionths of a US dollar. |
OrganizationSkill
| Field | Type | What it is |
|---|---|---|
name | string | The model-facing name, [a-z0-9][a-z0-9_-]{0,62}. Required. |
description | string | Discovery description, nonempty and at most 4 KiB. Required. |
body | string | Instructions loaded by organization.skill.get, nonempty and at most 256 KiB. Required. |
FileRef
| Field | Type | What it is |
|---|---|---|
uri | string | Where the file is. Required. |
media_type | string | Its media type, for example image/png. |
filename | string | Its display name. |
Response
| Field | Type | What it is |
|---|---|---|
session | AgentSession | The durably accepted session; acceptance is not task completion. Output only. |
initial_event | SessionEvent | The initial message event committed with the session and pending turn. Output only. |
delivery | string | Result-delivery progress, independent of lease cleanup. Output only. |
cleanup | string | Lease-cleanup progress; released requires terminal lease evidence. Output only. |
agent_run | AgentRun | The immutable AgentRun binding, present only on a Room-bound attempt. Output only. |
AgentSession
| Field | Type | What it is |
|---|---|---|
name | string | orgs/{org}/projects/{project}/envs/{env}/agent_sessions/{agent_session}. |
uid | string | ases_<cell><ulid>; never reused. Output only. |
meta | ResourceMeta | Resource metadata. |
agent | string | The Agent the session talks to. Required. |
agent_version | string | The AgentVersion the session pinned; the Agent's current version when unset at create. |
end_user | string | The Sylphx Auth end user the session belongs to, set from the caller's end-user session; empty for a session a secret key started. An end user reads and changes only their own sessions. Output only. |
title | string | A short title; set by the caller or summarised by the runtime. |
state | SessionState | The session's state. Output only. One of idle, running, awaiting_approval, awaiting_client, failed, archived. |
turn_count | int64 | The number of turns started, from 0. Output only. |
last_event_sequence | int64 | The sequence of the newest event, from 0. Output only. |
create_time | timestamp | When the session was created. Output only. |
update_time | timestamp | When the last event was appended. Output only. |
usage | SessionUsage | What the session has used so far. Output only. |
environment_lease | string | The Sylphx Sandboxes lease attached to the session, while it has one. Output only. |
environment | EnvironmentSpec | The immutable effective environment for this session. RunAgent resolves it from the pinned AgentVersion's frozen default and selected request overrides. For CreateAgentSession, omission inherits the pinned default; an explicit environment replaces it. |
credentials | map<string, CredentialBinding> | Session-scoped credential bindings, keyed by the tool or MCP credential name. Values are references or opaque handles, never secret values. |
profiles | ProfileMount[] | Granted platform Profiles to mount when the session starts, each by resource name and mode. The runtime never puts profile values in events. |
verifies | string[] | The maker sessions this session verifies, as its :run named them; empty for any other session. Output only. |
archive_time | timestamp | When the session was archived; unset while it is not archived. Output only. |
organization_context | struct | The pinned organization layer: its sha256 digest, instructions and skill names and descriptions. Skill bodies are never returned. Output only. |
organization_layer | OrganizationLayer | The organization layer the caller binds at assignment, read from its own versioned store. Admission pins it for the session's life: its instructions and skill index are injected at every activation, and a skill body is read from the pin only when the agent loads it. Never returned; organization_context shows the pin. |
SessionEvent
| Field | Type | What it is |
|---|---|---|
name | string | orgs/{org}/projects/{project}/envs/{env}/agent_sessions/{agent_session}/session_events/{session_event}. |
uid | string | sevt_<cell><ulid>; never reused. Output only. |
meta | ResourceMeta | Resource metadata. |
sequence | int64 | The position in the session's log, from 1, with no gaps. Output only. |
type | SessionEventType | What the event is. Output only. One of user_message, steer, agent_message, tool_call, tool_result, approval_requested, approval_decided, status, compaction, thought, file_change, response, error, usage, sandbox, wait_changed, wait_continuation. |
turn | int64 | The turn it belongs to, from 1; 0 for an event outside a turn. Output only. |
step | int64 | The step within the turn, from 1, assigned by the runtime; 0 for an event that is not a step. Output only. |
create_time | timestamp | When it was appended. Output only. |
usage | StepUsage | Observed accounting for this step; absent values are unknown, never zero. Output only. |
step_key | string | Stable runtime-assigned effect key, independent of invocation attempts. Output only. |
message | Message | For USER_MESSAGE, STEER and AGENT_MESSAGE. One of the payload group. |
tool_call | ToolCall | For TOOL_CALL. One of the payload group. |
tool_result | ToolResult | For TOOL_RESULT. One of the payload group. |
approval | Approval | For APPROVAL_REQUESTED and APPROVAL_DECIDED. One of the payload group. |
status_change | StatusChange | For STATUS. One of the payload group. |
thought | Message | For THOUGHT: a reasoning summary, never private model reasoning. One of the payload group. |
file_change | FileChange | For FILE_CHANGE. One of the payload group. |
response | TurnResult | For RESPONSE: the completed turn's answer and usage. One of the payload group. |
error | ErrorEvent | For ERROR. One of the payload group. |
sandbox | SandboxActivity | For SANDBOX: authoritative allocation/release history, including replacements. One of the payload group. |
wait | AgentSessionWait | For WAIT_CHANGED: a durable wait fact, without execution authority. One of the payload group. |
wait_continuation | SessionWaitContinuation | For WAIT_CONTINUATION: ready owners consumed by exact turn admission. One of the payload group. |
AgentRun
| Field | Type | What it is |
|---|---|---|
id | string | Stable run identity, also the id of the output message. Output only. |
workspace_id | string | Workspace supplied by the Room authority. Output only. |
room_id | string | Room supplied by the Room authority. Output only. |
agent | string | The pinned Agent name. Output only. |
session | string | Session executing this attempt. Output only. |
ResourceMeta
| Field | Type | What it is |
|---|---|---|
generation | int64 | Increases by one on every change to spec. Output only. |
etag | string | Strong ETag (AIP-154): changes on any change to spec, status, or metadata. Send it back as If-Match or etag to make Update and Delete conditional; a mismatch fails with ABORTED / 409 ETAG_MISMATCH. Output only. |
create_time | timestamp | When the Resource was created. Output only. |
update_time | timestamp | When the Resource last changed. Output only. |
delete_time | timestamp | Set while the Resource is being deleted. Output only. |
labels | map<string, string> | Caller-writable, indexed labels (AIP-122 label rules). |
annotations | map<string, string> | Caller-writable, unindexed annotations. |
display_name | string | Caller-writable human-readable name. |
creator | string | The principal that created the Resource. Output only. |
SessionUsage
| Field | Type | What it is |
|---|---|---|
active_turn_duration | duration | Time turns were active. Output only. |
gateway_calls | int64 | Tool calls made through the gateway. Output only. |
spend_micros | int64 | Spend so far in micro-USD, models and tools together. Output only. |
EnvironmentSpec
| Field | Type | What it is |
|---|---|---|
shape | string | A Sylphx Sandboxes shape; empty gives sessions no environment. |
idle_standby | duration | Put the environment in standby after this long idle, 1m to 24h; default 10m. |
template | string | The Sandboxes image: template:<name> or an artifact image by digest, passed unchanged to the lease's image field. |
repo | RepositorySpec | The repository to prepare inside the fresh lease, if any. |
egress | LeaseNetwork | The lease's outbound policy, using the Sandboxes network contract. |
budget | LeaseBudget | The lease's CPU and cost ceiling, separate from model and tool spend. |
ttl | duration | The lease's maximum wall time, passed to Sandboxes as ttl. The lease is released when the session ends even if this bound has not been reached. |
CredentialBinding
| Field | Type | What it is |
|---|---|---|
secret | string | A Kernel Secret of this environment, by name. One of the source group. |
connection | string | A Kernel Connection (a third-party OAuth installation), by name. One of the source group. |
end_user_provider | string | The end user's own grant in Sylphx Auth's agent token vault, by provider id; the session's end user must hold it. One of the source group. |
placement | string | How the value is sent: bearer (default), header:<Name> or query:<name>. |
handle | string | An opaque credential handle issued for this session, resolved only at egress. This is never a credential value. Never returned again. One of the source group. |
ProfileMount
| Field | Type | What it is |
|---|---|---|
name | string | orgs/{org}/projects/{project}/envs/{env}/profiles/{profile}. Required. |
mode | string | read_only (default) or write_back. Only a write_back grant saves changes at session end while its lease still answers; empty is read_only. |
OrganizationLayer
| Field | Type | What it is |
|---|---|---|
instructions | string | Always loaded organization instructions, at most 256 KiB. |
skills | OrganizationSkill[] | Up to 256 skills with unique names; the layer is at most 1 MiB in total. |
StepUsage
| Field | Type | What it is |
|---|---|---|
input_tokens | uint64 | Uncached input tokens the step was charged for; absent when unknown. Output only. |
cached_tokens | uint64 | Input tokens served from the provider cache; absent when unknown. Output only. |
output_tokens | uint64 | Output tokens; absent when unknown. Output only. |
cost_usd | string | The exact decimal USD charge the gateway reported; absent when unknown. Output only. |
model | string | The catalog id the step ran on; empty for a step with no inference. Output only. |
kind | string | model, tool, compaction or subcall. Output only. |
first_delta_time | timestamp | For a model step: when the runtime received the stream's first non-empty assistant text or tool-call delta (not a role-only or empty chunk), on the runtime's clock, from the attempt that produced the recorded step. Output only. |
Message
| Field | Type | What it is |
|---|---|---|
parts | ContentPart[] | The content, in order; 1 to 64 parts. Required. |
ToolCall
| Field | Type | What it is |
|---|---|---|
id | string | The call's id within the session, (turn, step) based. Output only. |
tool | string | The tool name. Output only. |
input | struct | The input, as the model sent it. Output only. |
model_call_id | string | The model's own id for the call, as sent; never used as a key. Output only. |
client | bool | Whether the client must execute this pending call. Calls rejected before dispatch remain in history with this false and a corresponding ToolResult. Output only. |
deadline | timestamp | The client call's fixed deadline. A reconnecting client never starts a call after this time; retries retain the original deadline and call id. Output only. |
ToolResult
| Field | Type | What it is |
|---|---|---|
call_id | string | The ToolCall's id. Output only. |
output | value | The output. Output only. |
error | bool | Whether the call failed; output then holds the error. Output only. |
duration | duration | How long the call took. Output only. |
Approval
| Field | Type | What it is |
|---|---|---|
call_id | string | The ToolCall's id. Output only. |
decision | ApprovalDecision | The answer, once given; unset while it waits. Output only. One of approve, reject. |
remember | bool | Whether the answer covers later calls of the same tool in this session ("always allow"). Output only. |
principal | string | Who answered. Output only. |
reason | string | The reason given, if any. Output only. |
StatusChange
| Field | Type | What it is |
|---|---|---|
state | SessionState | The state after the change. Output only. One of idle, running, awaiting_approval, awaiting_client, failed, archived. |
reason | string | Why, for FAILED and INTERRUPTED: a registry error code and message. Output only. |
FileChange
| Field | Type | What it is |
|---|---|---|
path | string | The path relative to the session's repository root. Output only. |
change | string | added, modified, deleted, renamed or copied. Output only. |
added | int64 | Lines added, when reported by the harness. Output only. |
removed | int64 | Lines removed, when reported by the harness. Output only. |
old_path | string | The previous path, for a rename or copy. Output only. |
source | string | edit for an incremental edit or final for the turn's final diff. Output only. |
TurnResult
| Field | Type | What it is |
|---|---|---|
text | string | The final response's text. Output only. |
is_error | bool | Whether the turn ended with an error. Output only. |
usage | TurnTokenUsage | Model token usage reported by the harness. Output only. |
cost_micros | int64 | The reported cost, in micro-USD. Output only. |
duration | duration | How long the turn ran. Output only. |
first_delta_time | timestamp | The first non-empty assistant text or tool-call delta of the turn: the earliest first_delta_time of its recorded model steps. Output only. |
ErrorEvent
| Field | Type | What it is |
|---|---|---|
kind | string | The registry error code or harness error kind. Output only. |
message | string | A safe error description. Output only. |
SandboxActivity
| Field | Type | What it is |
|---|---|---|
lease | string | The lease's resource name. Output only. |
state | string | allocated or released (the release was read back as ENDED). Output only. |
sandbox_seconds | string | On released: exact decimal seconds from allocation to release. Output only. |
AgentSessionWait
| Field | Type | What it is |
|---|---|---|
name | string | Exact name; the final segment is the conserved wait UUID. |
uid | string | Immutable platform Resource UID. Output only. |
meta | ResourceMeta | Standard metadata. Output only. |
goal | string | Optional exact Goal in this Session, never a current-Goal selector. |
type | string | time or signal. Other producer types require their own admitted adapter. Required. |
reference | string | Exact source reference for a signal; empty for a timer. |
deadline | timestamp | Actual future due time; required only for a timer. |
resume_prompt | string | What to do after observing this wait's evidence, at most 16 KiB. Required. |
state | string | active, ready, resolved or cancelled. Ready still requires turn admission. Output only. |
evidence | struct | Original bounded observed evidence, retained through delivery and restart. Output only. |
resumed_turn | int64 | The only turn that consumed this wait; unset until resolved. Output only. |
create_time | timestamp | Creation time. Output only. |
update_time | timestamp | Last state change time. Output only. |
SessionWaitContinuation
| Field | Type | What it is |
|---|---|---|
waits | AgentSessionWait[] | Conserved wait snapshots and observed evidence for this exact turn. Output only. |
RepositorySpec
| Field | Type | What it is |
|---|---|---|
uri | string | The repository URI. Access uses the session's bound credential handles. Required. |
revision | string | The commit or ref to check out; empty uses the repository's default branch. |
LeaseNetwork
| Field | Type | What it is |
|---|---|---|
egress | EgressPolicy | Default ALLOW. One of allow, deny, allowlist. |
allowed_domains | string[] | Hosts reachable when egress is ALLOWLIST: exact names or one leading *. wildcard label, for example api.openai.com, *.github.com. |
allowed_cidrs | string[] | Public CIDRs reachable when egress is ALLOWLIST. |
blocked_cidrs | string[] | The ranges blocked under every policy. Output only. |
LeaseBudget
| Field | Type | What it is |
|---|---|---|
max_cpu_seconds | int64 | End CPU_BUDGET after this many vCPU-seconds of guest CPU time. |
max_cost_micros | int64 | End COST_BUDGET once the shape's list price times wall seconds reaches this many millionths of a US dollar. |
OrganizationSkill
| Field | Type | What it is |
|---|---|---|
name | string | The model-facing name, [a-z0-9][a-z0-9_-]{0,62}. Required. |
description | string | Discovery description, nonempty and at most 4 KiB. Required. |
body | string | Instructions loaded by organization.skill.get, nonempty and at most 256 KiB. Required. |
ContentPart
| Field | Type | What it is |
|---|---|---|
text | string | Text. One of the part group. |
file | FileRef | A file, by Sylphx Data object URL or an https URL. One of the part group. |
TurnTokenUsage
| Field | Type | What it is |
|---|---|---|
input_tokens | int64 | Input tokens. Output only. |
output_tokens | int64 | Output tokens. Output only. |
cache_read_tokens | int64 | Input tokens read from the model's cache. Output only. |
cache_write_tokens | int64 | Input tokens written to the model's cache. Output only. |
Errors
UNAUTHENTICATED— No valid key or token was presented.PERMISSION_DENIED— The key lacks the method's permission.INVALID_FIELD— A field failed validation.RESOURCE_ALREADY_EXISTS— A Resource with this name exists.IDEMPOTENCY_KEY_REUSED— An Idempotency-Key was reused with another body.IDEMPOTENCY_IN_PROGRESS— The first call with this Idempotency-Key is still running.PLAN_LIMIT_REACHED— The plan's limit is reached.SPEND_LIMIT_REACHED— The org's spend limit is reached.INVALID_STATE— The Resource is in a state that forbids the call.
Every error arrives in the body Errors describes.
Examples
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/agents/agent:run" \
-H "Authorization: Bearer $SYLPHX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"agent_session_id":"…","agent_version":"…","completion":{"tool":"…"},"message":{"parts":[{}]},"runtime_credential_handle":"…"}'