Skip to main content

Module agent_queue

Module agent_queue 

Source
Expand description

Agent-answered LLM backend queue.

When NetGet runs as an MCP server in --llm-agent mode, protocol servers do not call any model. Instead every LLM request is enqueued here and answered by the calling MCP agent (e.g. Claude Code) via the get_next_llm_request / answer_llm_request tools. This mirrors the oneshot-rendezvous pattern used by the FIDO2 ApprovalManager (src/server/usb/fido2/approval.rs) and WebApprovalRequest (src/state/app_state.rs): the producer submits a request plus a oneshot::Sender and awaits the receiver; the consumer resolves it from outside.

Two notification paths are offered and the agent picks whichever fits:

  • a long-poll: get_next_llm_request { wait_seconds } blocks on Notify,
  • a best-effort FIFO push: on enqueue the new request id is written to the configured named pipe so an idle agent can block-read it and get woken.

Structsยง

LlmRequestQueue
A queue of pending LLM requests answered out-of-band by the MCP agent.
PendingLlmRequest
A queued LLM request awaiting an answer from the calling agent.