API: @loopstack/code-agent
Classes
CodeAgentModule
NestJS module that provides the codebase-exploration tool ExploreTask (explore_task), which launches an AgentWorkflow sub-agent that searches and reads a remote workspace with the glob/grep/read tools and returns a synthesized answer.
Registration:
CodeAgentModule— bare import registersExploreTaskand re-exportsAgentModule; use this when the agent’s default LLM configuration is fine.CodeAgentModule.forFeature(config?: { llm?: LlmModuleConfig })— use to override the LLM provider/model for the code agent; it importsAgentModule.forFeature(config).
Requires, configured in your app:
LlmProviderModulewith a registered LLM provider — needed by the importedAgentModule.RemoteClientModule(bare orforRoot) — supplies theglob/grep/readtools theexplore_tasksub-agent uses. Without it the app fails at boot with an error namingRemoteClientModule.
import { CodeAgentModule } from '@loopstack/code-agent';export class CodeAgentModule { static forFeature(config?: { llm?: LlmModuleConfig }): DynamicModule;}ExploreTask
Tool that launches an AgentWorkflow sub-agent to explore and analyze a codebase with the glob/grep/read tools and return a synthesized summary.
Those tools come from RemoteClientModule. Constructing ExploreTask without them throws, so an app
that has not wired the remote client fails at boot instead of on the first explore_task call.
import { ExploreTask } from '@loopstack/code-agent';Provided by: CodeAgentModule
export class ExploreTask extends BaseTool<ExploreTaskInput, object, ExploreTaskResult> { constructor(agentWorkflow: AgentWorkflow, globTool?: GlobTool, grepTool?: GrepTool, readTool?: ReadTool); protected handle( args: ExploreTaskInput, ctx: RunContext, options?: ToolCallOptions, ): Promise<ToolEnvelope<ExploreTaskResult>>; complete(result: Record<string, unknown>): Promise<ToolEnvelope<ExploreTaskResult>>;}Type Aliases
ExploreTaskInput
Args for ExploreTask.
import { ExploreTaskInput } from '@loopstack/code-agent';export type ExploreTaskInput = z.infer<typeof ExploreTaskInputSchema>;ExploreTaskResult
Result for ExploreTask (explore_task) — the synthesized exploration summary or its pending workflow reference.
import { ExploreTaskResult } from '@loopstack/code-agent';export type ExploreTaskResult = | { workflowId: string; } | string | Record<string, unknown>;Variables
ExploreTaskInputSchema
Zod schema for ExploreTask args.
import { ExploreTaskInputSchema } from '@loopstack/code-agent';ExploreTaskInputSchema: z.ZodObject< { instructions: z.ZodString; }, z.core.$strict>;ExploreTaskResultSchema
Zod schema for ExploreTaskResult — the synthesized summary string or, when the
sub-workflow returned no response text, its raw result record.
import { ExploreTaskResultSchema } from '@loopstack/code-agent';ExploreTaskResultSchema: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;