MCPcopy Create free account
hub / github.com/NousResearch/hermes-agent-self-evolution / SkillModule

Class SkillModule

evolution/skills/skill_module.py:84–114  ·  view source on GitHub ↗

A DSPy module that wraps a skill file for optimization. The skill text (body) is the parameter that GEPA optimizes. On each forward pass, the module: 1. Uses the skill text as instructions 2. Processes the task input 3. Returns the agent's response

Source from the content-addressed store, hash-verified

82
83
84class SkillModule(dspy.Module):
85 """A DSPy module that wraps a skill file for optimization.
86
87 The skill text (body) is the parameter that GEPA optimizes.
88 On each forward pass, the module:
89 1. Uses the skill text as instructions
90 2. Processes the task input
91 3. Returns the agent's response
92 """
93
94 class TaskWithSkill(dspy.Signature):
95 """Complete a task following the provided skill instructions.
96
97 You are an AI agent following specific skill instructions to complete a task.
98 Read the skill instructions carefully and follow the procedure described.
99 """
100 skill_instructions: str = dspy.InputField(desc="The skill instructions to follow")
101 task_input: str = dspy.InputField(desc="The task to complete")
102 output: str = dspy.OutputField(desc="Your response following the skill instructions")
103
104 def __init__(self, skill_text: str):
105 super().__init__()
106 self.skill_text = skill_text
107 self.predictor = dspy.ChainOfThought(self.TaskWithSkill)
108
109 def forward(self, task_input: str) -> dspy.Prediction:
110 result = self.predictor(
111 skill_instructions=self.skill_text,
112 task_input=task_input,
113 )
114 return dspy.Prediction(output=result.output)
115
116
117def reassemble_skill(frontmatter: str, evolved_body: str) -> str:

Callers 1

evolveFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected