Status: Current reference. For active product truth and operational boundaries, start with
docs/current-source-of-truth.md.
每条 route 都包含:Trigger / Pipeline / Tool Boundary / State / Output Boundary / Observability / Failure Points。
- Trigger
POST /v1/agent/runs(createFridayAgentRoutes,src/api/http/routes/friday-agent-routes.ts:75)
- Pipeline
- Route validation +
deps.startRun(...)(friday-agent-routes.ts:85-160) - API runtime
startRunbridges to runtime (src/api/runtime/friday-api-runtime.ts:1346-1360) - Runtime core loop
executeRun(src/agent/runtime/friday-agent-runtime.ts:148) - For each model
tool_use, dispatchexecuteToolCall(friday-agent-runtime.ts:655-664,1507-1631) - Persist terminal state + return response/images (
friday-agent-runtime.ts:822-958)
- Route validation +
- Tool Boundary
- Enters at
executeToolCall(friday-agent-runtime.ts:1507)
- Enters at
- State
- Run record create/update in agent run repository (
friday-agent-runtime.ts:167-179and updates in same file) - Session-linked history via
sessionKey
- Run record create/update in agent run repository (
- Output Boundary
- API JSON envelope includes run result
- Observability
agent.run.*events (emitRunEventpath in runtime)
- Failure Points
- invalid input ->
VALIDATION_ERROR - run timeout/abort
- unknown/blocked tool, tool runtime error
- invalid input ->
- Trigger
- LLM returns
toolUseBlocks.length === 0in runtime loop
- LLM returns
- Pipeline
enforceToolEvidenceForCompletionClaim(...)(src/agent/runtime/friday-agent-runtime.ts:1112-1122)enforceFeedbackPersistenceEvidence(...)(1124-1134)shouldEnforceToolEvidenceForTask(...)decides re-prompt (1186-1204)- inject "System verification" message and continue loop (
471-505)
- Tool Boundary
- No external tool call in first turn; route forces a second attempt with tools
- State
- same runId/sessionKey; extra user verification turn appended to in-memory message list
- Output Boundary
- Either tool-backed response, or explicit unverified note
- Observability
- same run event stream; additional iteration events visible
- Failure Points
- if tools unavailable/disabled, guard degrades to explicit unverified text
- Trigger
- Tool call
web_fetchreturns error
- Tool call
- Pipeline
executeToolCallexecutesweb_fetch(src/agent/runtime/friday-agent-runtime.ts:1570-1576)- On error result, call
maybeFallbackWebFetchWithBrowser(...)(1576-1586,1643-1781) - Fallback steps: browser
openthensnapshotwithagent.run.tool_start/tool_endevents (1659-1764) - Security gating in
shouldAttemptWebFetchBrowserFallback(...)(1783-1797)
- Tool Boundary
web_fetch(src/agent/tools/friday-agent-web-fetch-tool.ts:64) andbrowsertool boundary
- State
- Same tool call record for primary
web_fetch; fallback events use derived call ids
- Same tool call record for primary
- Output Boundary
- Caller gets merged result text (includes fallback tag + snapshot output)
- Observability
- explicit fallback tool start/end events
- Failure Points
- no browser tool available
- browser open/snapshot error
- SSRF/security block (fallback intentionally skipped)
- Trigger
web_fetchtool invocation with URL
- Pipeline
- Parse/validate args in
createFridayAgentWebFetchTool.execute(src/agent/tools/friday-agent-web-fetch-tool.ts:92-105) - Use
fetchWithFridayAgentSsrfGuard(...)when guard configured (133-137) - Redirect-by-redirect DNS revalidation (
src/agent/security/friday-agent-fetch-guard.ts:41-109) - Protocol/hostname/private-IP checks (
src/agent/security/friday-agent-ssrf-guard.ts:492-567)
- Parse/validate args in
- Tool Boundary
- DNS + HTTP fetch
- State
- Stateless per call; failure returned as tool result
- Output Boundary
- Tool result text includes HTTP summary or explicit blocked reason
- Observability
- Tool result captured in run history +
tool_endsummary
- Tool result captured in run history +
- Failure Points
- blocked protocol/hostname/private IP
- DNS failure / redirect loop / too many redirects
- Trigger
POST /v1/workflow-runs, thenGET /v1/workflow-runs/:runId/timeline
- Pipeline
- Route validation (
src/api/http/routes/friday-workflow-run-routes.ts:98-124) - API runtime bridge to execution service
startRun(...)(src/api/runtime/friday-api-runtime.ts:688-713) - Execution service creates run and non-blocking
executeRun(plan).catch(...)(src/workflows/services/friday-workflow-execution-service.ts:819-963) - Timeline route reads event envelopes (
src/api/runtime/friday-api-runtime.ts:726-748)
- Route validation (
- Tool Boundary
- Workflow nodes may call external integrations/tools
- State
- run/node/event persisted in workflow repositories
- Output Boundary
- timeline JSON entries (
seq/event/status/payload)
- timeline JSON entries (
- Observability
- async crash codes
E-WF-RUN-ASYNC-001..004
- async crash codes
- Failure Points
- workflow/version missing, permission denied, async execution error
- Trigger
POST /v1/workflow-runs/:runId/evidence/exportsGET /v1/workflow-runs/:runId/evidence/exports/:exportId/download
- Pipeline
- Run route definitions (
src/api/http/routes/friday-workflow-run-routes.ts:167-208) - API runtime bridge (
src/api/runtime/friday-api-runtime.ts:756-789) - Runtime export writes artifact row + export row + JSON file (
src/workflows/runtime/friday-workflow-runtime.ts:1610-1672) - Download prefers file, falls back to JSON body (
1733-1762)
- Run route definitions (
- Tool Boundary
- File system write/read (
.friday/artifacts/workflow-evidence/...)
- File system write/read (
- State
- DB tables for artifacts/evidence exports + optional file URI
- Output Boundary
- download response includes
content+file.exists/path/sizeBytes
- download response includes
- Observability
- checksums + export metadata
- Failure Points
- missing export ->
WORKFLOW_RUN_EVIDENCE_EXPORT_NOT_FOUND - persistence failure -> fallback URI/content
- missing export ->
- Trigger
- automation with cron schedule
- Pipeline
- Hub attaches scheduler bridge (
src/hub/friday-hub-bootstrap.ts:1691-1751) - Scheduler registers dynamic job (
1727-1749) - Job run calls
automationService.runand validates terminal status (1739-1746) - scheduler core handles timeout/backoff/catch-up (
src/jobs/scheduler/friday-job-scheduler-service.ts:154-308)
- Hub attaches scheduler bridge (
- Tool Boundary
- timer scheduler + agent runtime call
- State
- scheduler repo
last_status/last_error/next_run_at
- scheduler repo
- Output Boundary
- visible through automation/run APIs and scheduler persisted state
- Observability
- explicit error token
[E-SCHED-AUTOMATION-RUN-FAILED]
- explicit error token
- Failure Points
- cron parse invalid, job timeout, run non-completed terminal
- Trigger
- webchat WS
messageframe or discordMESSAGE_CREATE
- webchat WS
- Pipeline
- WS upgrade routing (
src/api/http/friday-http-server.ts:854-877) - webchat frame parsing + normalize (
src/channels/webchat/webchat-service.ts:201-367,src/channels/webchat/friday-webchat-channel.ts:31-47) - discord normalize + outbound adapter (
src/channels/discord/friday-discord-channel.ts:81-125,194-248) - hub channel handler executes run and composes terminal text/images (
src/hub/friday-hub-bootstrap.ts:1992-2166) - outbound primary send to channel adapter (
2160-2167) - if primary send fails: structured audit log + session fallback persistence + outbound retry (
2168-2206)
- WS upgrade routing (
- Tool Boundary
- channel transport APIs + optional file reads for attachments
- State
- session mirror/history + run state + audit jsonl
- Output Boundary
- user sees channel message (success/failure/cancel) and attachments; on send failure sees fallback text carrying error code + run query path
- Observability
- warning/error codes:
W-CH-SESSION-MIRROR-001,W-CH-HISTORY-001,E-CH-RUN-001,E-CH-OUTBOUND-001,E-CH-OUTBOUND-RETRY-001 audit.jsonldetails includerouteId/toolName?/runId?/correlationId/channelCorrelationId
- warning/error codes:
- Failure Points
- session mirror/history errors
- run execution errors
- outbound transport primary failure (retry path)
- outbound transport retry failure (falls back to persisted session message + audit)
- Trigger
POST /v1/providers/detectGET /v1/observability/*(when not wired)
- Pipeline
- Provider detect validation and probing (
src/api/http/routes/friday-setup-routes.ts:440-599) - observability routes optional registration (
src/api/runtime/friday-api-runtime.ts:1021-1026) - unmatched observability path fallback message (
src/api/http/friday-http-server.ts:458-467)
- Provider detect validation and probing (
- Tool Boundary
- provider HTTP endpoints
- State
- setup/provider config state in DB
- Output Boundary
- detect result JSON or explicit validation/unreachable error
- explicit not-enabled message instead of generic 404
- Observability
- error code + requestId in envelope
- Failure Points
- missing api key/kind/baseUrl, provider unreachable, observability not enabled
- Trigger
- startup initialize and
GET /v1/skills
- startup initialize and
- Pipeline
- registry init/refresh (
src/skills/registry/friday-skill-registry.ts:27-30,153-233) - root resolution and candidate scan (
src/skills/registry/friday-skill-discovery.ts:19-123) - route output (
src/api/http/routes/friday-skill-routes.ts:18-38)
- registry init/refresh (
- Tool Boundary
- filesystem scan and manifest loading
- State
- registry memory + discovered snapshot persistence
- Output Boundary
- skills list JSON to user
- Observability
- reload failure audit log (
SKILL_RELOAD_FAILED)
- reload failure audit log (
- Failure Points
- invalid manifest/trust rejection/permissions on directories