lloyal-agents API Reference
    Preparing search index...

    Function runAgents

    • Run an agent pool with automatic branch cleanup on return

      Wraps useAgentPool in scoped() — agent branches are pruned when the scope exits, before this operation returns. Use this when you don't need to fork from agent branches after the pool completes.

      For multi-level tree topology (forking from agent branches for verification or follow-up), use useAgentPool directly within your own scope management.

      Parameters

      • opts: AgentPoolOptions

        Pool configuration: tasks, tools, sampling params, max turns

      Returns Operation<AgentPoolResult>

      Agent pool result (branches already pruned)

      const pool = yield* withSharedRoot(
      { systemPrompt: RESEARCH_PROMPT, tools: toolsJson },
      function*(root, prefixLen) {
      return yield* runAgents({
      tasks: questions.map(q => ({
      systemPrompt: RESEARCH_PROMPT,
      content: q,
      tools: toolsJson,
      parent: root,
      })),
      tools: toolMap,
      maxTurns: 6,
      });
      },
      );