wayfinder
MAmattpocock/skills336k近 7 天新增 5,004 个 star
Agent in the Loop: the pseudo-model loop/mcp makes every model call of a chat run a step that an external MCP client (Claude Code, Codex) answers over the inbound MCP server. A loop model must answer only inside its own run scope, never wait outside one, never be retried, and never let the outside brain approve its own dangerous actions. Trigger: editing agentic/agent_in_the_loop/; adding a model call site or a retry loop in the agent; adding a path that builds an LLM from a model id; editing webapp/src/lib/mcp/loop*.ts, webapp/src/lib/agentInTheLoop.ts, or the LOOP_STATUS handling in the chat drawer.
/loop/* routes.get_broker().scope_for_session(current_log_session_id), never
from current_user_id, current_project_id or current_session_id: initialize_node
calls the guardrail and the classifier before any node sets those
(model.py, agent_context.py).loop/ with
refuse_loop_model() / LoopModelNotSupportedHere (code loop_model_not_supported_here):
no chat run, no driver, a wait that never ends (llm_builder.py,
the api.py builders). Feature pickers filter it with excludeLoop, saves refuse it.no_retry = True and their messages contain
no transient phrase (timeout, connection, a bare 5xx); is_transient_llm_error checks
the marker first. A new loop that retries on ANY exception must break on
getattr(e, "no_retry", False) (errors.py,
phase.py is the example).runEndsIfSilentSeconds on every step
and the pack tells it never to end its turn while a run is live; the drawer gets
noDriverEndsInSeconds and shows the clock time the run ends. A new timer or cap that ends
a run goes into both, or a driver that read only deadlineInSeconds believes it has longer.
Keep LOOP_STEP_DEADLINE_S above LOOP_NO_DRIVER_GRACE_S: the deadline counts from the
step's opening, so a lower one ends a pause first.llm_purpose(...) label, or its step reaches the driver
as other with a text answer format (purpose.py).REQUIRE_TOOL_CONFIRMATION, and an unattended run
shows it. The gates read the setting as in a provider run; _stream_graph passes it to
run_scope(tool_confirmation=...), the drawer's loop_status carries it as
toolConfirmation, and false puts a red risk icon next to the Agent in the Loop chip
(loopStatus.ts).
It stays out of the driver's view and the step (a step change bumps contractVersion)._refused_without against the ticket's cap, then
_refused_now, which asks the webapp again and refuses when it cannot be reached; an admitted
answer is saved with decision_actor() (sub, act under act-as), as _record_decision does
(websocket_api.py). A new kind of answer takes all three.get_identifiers; the token's user on the MCP side); the project's owner is
only the graph tenant (get_tenant_id). A driver reaches a shared project only at
agent:loop's level through mcpProjectAccess (loopProjects in loopTools.ts).agent:loop. Compute it from
MCP_SCOPE_COPY with loopTokenProblem, never a hand list; the loop tools refuse wider
tokens (loopScopes.ts).loopModelRefusal, the preset checks, rememberedDefaults).contractVersion (agent CONTRACT_VERSION, the
skill pack's LOOP_CONTRACT_VERSION), so a client's out-of-date skill says so.LOOP_TOOL_NAMES (withdrawn while the switch is off), every MCP
test that stubs MCP_KALI_EXEC_ENABLED also stubs AGENT_IN_THE_LOOP_ENABLED, then
npm run docs:mcp (the mcp-server-tools skill).loop_status and the step views carry no prompt or answer text; the WebSocket frame
is sent, never persisted.| Concern | File |
|---|---|
Switch, tunables, is_loop_model, is_loop_llm | agentic/agent_in_the_loop/__init__.py |
| Steps, leases, deadlines, no-driver rule, dedup, pruning | agentic/agent_in_the_loop/broker.py |
| Run scope around every streaming graph loop | AgentOrchestrator._stream_graph in agentic/orchestrator.py |
| MCP tools, client, driver-token rule | webapp/src/lib/mcp/loopTools.ts, loopClient.ts, loopScopes.ts |
| Skill pack per client | webapp/src/lib/mcp/loopSkill.ts |
| Drawer status strings | webapp/src/app/graph/components/AIAssistantDrawer/hooks/loopStatus.ts |
| Fallback report when a loop step fails | agentic/orchestrator_helpers/nodes/generate_response_node.py |
Agent-in-the-Loop - setup for Claude Code and Codex, how it works, limitsllm-provider-integration, mcp-server-tools, rbac-authz, redamon-testingMAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star