On this page
Fork an agent session
Forks the durable history into a newly idle session with the same pinned version.
Forks the durable history into a newly idle session with the same pinned version.
- Path
POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/agent_sessions/agent-session:fork - Scope
agents:sessions - Effect
write— a successful call changes state. - Collection agent_sessions
Request
| Field | Type | What it is |
|---|---|---|
name | string | The source session, whose history is not modified. Required. |
through_event_sequence | int64 | Inclusive history cutoff, between zero and the source head. Omit for the head. |
title | string | The new session title. Omit to retain the source title. |
agent_session_id | string | The new session ID. Omit to let the service assign it. |
Response
| 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. |
max_context_tokens | int32 | Default context-window ceiling in tokens for this session. Omit to use the selected model's native window. A turn may override this default, but neither value can expand the model's native window. |
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. |
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. |
egress_credentials | EgressCredentialBinding[] | Initial bindings; use UpdateLeaseEgressCredentials on a running lease. The guest receives only caller-supplied sentinels. An authorized origin receives the secret and must be trusted by the caller not to disclose it. Rules do not grant any additional network access. |
credential_proxy | bool | Route this lease's outbound HTTPS through the credential proxy from its first boot, even with no initial bindings. Required for live additions. Initial bindings also opt in. Cannot be changed after creation. |
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. |
EgressCredentialBinding
| Field | Type | What it is |
|---|---|---|
sentinel | string | Opaque placeholder, unique within the lease. Supply it to the guest in its ordinary environment or application configuration, not as a secret. Required. |
allowed_hosts | string[] | Exact DNS names or one leading wildcard label, such as *.example.com. A wildcard matches exactly one label, not the apex or nested names. List the apex explicitly if needed. IP literals are refused. Required. |
allowed_ports | int32[] | Approved HTTPS ports. Empty means 443. |
secret_version | string | SecretVersion resource name in the lease's org, project and environment. Required. Never returned again. |
header | string | Case-insensitive HTTP header name. One of the target group. |
query_param | string | Case-sensitive query parameter name. One of the target group. |
request_body | bool | Replace literal placeholder bytes in an uncompressed request body; the proxy recalculates its length. Set to true to select this target. One of the target group. |
expire_time | timestamp | Required absolute cutoff for substitution. A request at or after this instant, after removal, or after the underlying authority is revoked is refused. Renewal never extends a binding's lifetime. Required. |
Errors
UNAUTHENTICATED— No valid key or token was presented.PERMISSION_DENIED— The key lacks the method's permission.RESOURCE_NOT_FOUND— The named Resource does not exist or is not visible.UNKNOWN_FIELD— The request has a field the schema does not know.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.
Every error arrives in the body Errors describes.
Examples
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/agent_sessions/agent-session:fork" \
-H "Authorization: Bearer $SYLPHX_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'