nexus-agents - v2.80.0
    Preparing search index...

    Function getSkillsForTask

    Skills module exports (Voyager-style skill library) - Issue #528 Split from agents.ts for file size compliance (Issue #285)

    • Gets skills appropriate for a task execution.

      Loads skills based on the agent's role and the task description, potentially including additional task-relevant skills beyond the agent's default role-based skills.

      Parameters

      • agent: IAgent

        The agent that will execute the task

      • task: Task

        The task to get skills for

      • loader: ISkillLoader

        The skill loader to use

      Returns Result<readonly Skill[], SkillLoaderError>

      Result with readonly array of skills or SkillLoaderError on failure

      const agent = createAgent({ id: 'agent-1', role: 'code_expert' });
      const task = { id: 'task-1', description: 'Refactor the user service' };
      const loader = createSkillLoader(library);

      const result = getSkillsForTask(agent, task, loader);
      if (result.ok) {
      console.log(`Loaded ${result.value.length} skills for task`);
      }