Status: historical RFC. The v1 alpha surface is now published inDocumentation Index
Fetch the complete documentation index at: https://docs.simplefunctions.dev/llms.txt
Use this file to discover all available pages before exploring further.
@spfunctions/agent/v1.
This RFC records the boundary that preceded the @spfunctions/agent/v1 alpha runtime. The alpha package now exposes a model-loop surface, sessions, hooks, watch primitives, and Cursor-style compatibility. The constraints remain: no endpoint expansion, no live trading, no CLI shell-out, and no hosted trace/session backend.
Current boundary
@spfunctions/agent v0 is the governed direct tool runner.
It provides:
- strict manifest loading from
GET /api/contracts/tools - canonical direct tool calls through
call() - event streaming through
stream() - policy gates for permissions,
sideEffect, andcostEffect - trace record/replay
- API-key-first live execution
/api/tools, or live-trading automation.
Non-goals
These remain non-goals for the v1 alpha:- model provider SDK dependency
- hosted run endpoint
- background worker
- MCP runtime
- browser runtime
- live trading
- write/default Agent tools
events.*market.relatedauth.statusinvestigations.createintents.proposewebhooks.create
sf agent. The CLI may later reuse Agent SDK internals, but the Agent SDK must remain an embeddable library.
Proposed package boundary
@spfunctions/sdk remains the typed data and contract client.
@spfunctions/agent v0 remains the governed direct runner:
@spfunctions/agent v1 adds objective-oriented runtime APIs:
run() and runStream() must be layered on top of the v0 direct runner. They must not bypass v0 policy, identity, trace, or canonical tool resolution.
Interface sketches
Tool selection
v1 should not load every broad hosted or MCP tool into context. The tool source remainsGET /api/contracts/tools, not /api/tools.
explicit: only tools supplied inRuntimeRunInput.toolspreload-only: only configured preloaded canonical toolsmanifest-search: search strict contract metadata, then select a small set of canonical candidates
get_world_state and get_regime_history remain invalid for v1 runtime planning.
Session and run state
v1 needs stable IDs and resumable state before it can be considered alpha.Policy, budgets, and approvals
v1 must enforce the same policy gates as v0 before any tool call:- identity
- canonical tool existence
- tool status
agent.callable- deny list
- allow list
maxSideEffectmaxCostEffect- user-data auth invariants
- live-trade hard stop
Human escalation
Human escalation is a runtime event and state transition, not an endpoint in this RFC.Trace and replay
v1 must preserve v0 replay rules:- strict
tool + inputHashmatching - replay miss never calls live
- input normalization is deterministic
- traces redact secret-shaped fields
- model prompts must not include raw API keys
- trace entries must distinguish model steps from direct tool calls
Implementation entry criteria
Do not implement v1 until these are true:| Entry criterion | Required evidence |
|---|---|
| v0 direct runner is package-stable | tests, pack smoke, live smoke |
| SDK preflight is stable | no-key/auth/cost/side-effect tests |
| strict manifest drift guards pass | /api/contracts/tools and package tests |
| trace redaction and replay tests pass | Agent trace suite |
| CLI/direct parity tests pass | CLI/manifest parity suite |
| alpha release checklist exists | SDK and Agent alpha checklist RFC |
| model adapter interface is approved | RFC review |
| tool selection plan is approved | RFC review |
| session and approval plan is approved | RFC review |
Test plan for future implementation
When implementation is approved, add tests before runtime expansion:- v1 refuses to construct without API-keyed client for live mode
- v1 resolves only canonical contract tools
- broad names are rejected
- model adapter receives only policy-approved tool candidates
maxSideEffectandmaxCostEffectare enforced before tool execution- approval-required runs stop before tool execution
- replay-only mode never calls live
- trace redaction covers model context and tool inputs
- no live trading tool can be enabled