name: dspy-agent-framework-quick-ref
Installation
$skills install @Qredence/dspy-agent-framework-quick-ref
Claude Code
Cursor
Copilot
Codex
Antigravity
Details
RepositoryQredence/agentic-fleet
Path.fleet/context/skills/dspy-agent-framework-quick-ref/SKILL.md
Branchmain
Scoped Name@Qredence/dspy-agent-framework-quick-ref
Usage
After installing, this skill will be available to your AI coding assistant.
Verify installation:
skills listSkill Instructions
name: dspy-agent-framework-quick-ref description: Quick reference card for DSPy + Agent Framework integration patterns: typed signatures, assertions, routing cache, and agent handoffs.
DSPy + Agent Framework Quick Reference
Typed Signatures
class TaskRouting(dspy.Signature):
task: str = dspy.InputField(desc="Task to route")
team: str = dspy.InputField(desc="Available agents")
decision: RoutingDecisionOutput = dspy.OutputField()
class RoutingDecisionOutput(BaseModel):
assigned_to: list[str] = Field(min_length=1)
execution_mode: Literal["delegated", "sequential", "parallel"]
subtasks: list[str] = Field(default_factory=list)
tool_plan: list[str] = Field(default_factory=list)
reasoning: str
DSPy Assertions
dspy.Assert(condition, "error message") # Hard constraint
dspy.Suggest(condition, "guidance") # Soft constraint
def validate_agent_exists(agents, available):
Assert(len(agents) > 0, "Must assign at least one agent")
for a in agents:
Assert(a.lower() in [x.lower() for x in available],
f"Agent {a} not in pool")
Routing Cache
class RoutingCache:
def __init__(self, ttl_seconds=300, max_size=1024):
self.ttl = ttl_seconds
self.max_size = max_size
def get(self, key): ... # Returns None if expired/missing
def set(self, key, value): ... # Auto-evicts oldest
def clear(self): ...
DSPy-Enhanced Agent
class DSPyEnhancedAgent(ChatAgent):
def __init__(self, reasoning_strategy="chain_of_thought"):
self.reasoning_strategy = reasoning_strategy
if reasoning_strategy == "react":
self.react_module = dspy.ReAct("q -> a", tools=self.tools)
elif reasoning_strategy == "chain_of_thought":
self.cot_module = dspy.ChainOfThought("q -> a")
Workflow with Checkpoints
from agent_framework._workflows import (
WorkflowStartedEvent, WorkflowStatusEvent,
WorkflowOutputEvent, ExecutorCompletedEvent,
RequestInfoEvent, FileCheckpointStorage
)
class SupervisorWorkflow:
def __init__(self, checkpoint_dir=".var/checkpoints"):
self.checkpoint_storage = FileCheckpointStorage(checkpoint_dir)
async def resume(self, checkpoint_id: str):
state = self.checkpoint_storage.load(checkpoint_id)
self.context.restore_from_state(state)
Agent Handoffs
class HandoffManager:
def prepare_handoff(self, from_agent, to_agent, context):
return {
"task": context["original_task"],
"findings": context.get("findings", []),
"decisions": context.get("decisions", []),
"from_agent_summary": self._summarize(from_agent)
}
def execute_sequential_with_handoffs(self, agents, tasks):
context = {"original_task": tasks[0], "findings": [], "decisions": []}
results = []
for i, (agent, task) in enumerate(zip(agents, tasks)):
handoff = self.prepare_handoff(
agents[i-1] if i > 0 else None, agent, context
)
result = self._run_with_context(agent, task, handoff)
context["findings"].extend(result.get("findings", []))
results.append(result)
return results
GEPA Optimization
agentic-fleet optimize # Outputs: .var/cache/dspy/compiled_reasoner.json
Config:
dspy:
use_typed_signatures: true
enable_routing_cache: true
routing_cache_ttl_seconds: 300
optimization:
use_gepa: true
gepa_auto: light
Key Imports
# DSPy
import dspy
from dspy import TypedPredictor, ChainOfThought, ReAct, ProgramOfThought
# Agent Framework
from agent_framework._agents import ChatAgent
from agent_framework._workflows import Workflow, AgentThread
from agent_framework._types import AgentRunResponse, ChatMessage
# Pydantic
from pydantic import BaseModel, Field
from typing import Literal
More by Qredence
View allinit
91system-init: Initialize or hydrate the agent's memory system and verify configuration.
repo-cleanup
91Repository Cleanup and Git Hygiene: **When to use this skill:**
fleet-agent
91Context-aware development assistant for AgenticFleet with auto-learning and dual memory (NeonDB + ChromaDB). Handles development workflows with intelligent context management.
context
91memory-system: Complete guide to the AgenticFleet memory system. Read this first.
