lloyal-agents API Reference
    Preparing search index...

    Class PlanTool

    Grammar-constrained query decomposition and intent classification.

    Analyzes a research query and produces an array of PlanQuestion sub-questions, each classified as "research" (answerable via search) or "clarify" (needs user input). Uses a JSON grammar to guarantee structured output. Returns an empty array if the query is focused enough to research directly.

    The harness interprets the result: all-research triggers parallel dispatch, all-clarify returns to the user, mixed drops clarify questions and dispatches only research ones.

    Hierarchy

    • Tool<{ query: string; context?: string }>
      • PlanTool
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    description: "Analyze a research query. Return sub-questions classified as \"research\" (answerable via web search) or \"clarify\" (needs user input). Return empty array if the query is focused enough to research directly." = 'Analyze a research query. Return sub-questions classified as "research" (answerable via web search) or "clarify" (needs user input). Return empty array if the query is focused enough to research directly.'

    Human-readable description shown to the model

    name: "plan" = 'plan'

    Tool name — used as the function identifier in tool calls

    parameters: JsonSchema = ...

    JSON Schema describing the tool's expected arguments

    Methods

    • Execute the tool with parsed arguments

      Called by the agent pool when the model emits a tool call matching this tool's name. The return value is JSON-serialized and prefilled back into the agent's context as a tool result.

      Returns an Effection Operation — implement as a generator method. The operation runs inside the agent pool's scope, so it has access to Ctx, Store, and Events contexts for nested agent spawning.

      Parameters

      • args: { query: string; context?: string }

        Parsed arguments from the model's tool call

      Returns Operation<unknown>

      Tool result (will be JSON-serialized)