design_context_architecture
Design custom agent architectures for persistent workflows by generating blueprints of cognitive components based on user goals and constraints.
Instructions
Architects a custom context system based on a high-level goal (The Architect).
Returns a blueprint of Sutra components (Molecules, Cells, Organs, Thinking Models).
Use this when the user wants to build a persistent agent or complex workflow
rather than solving a single immediate task.
Args:
goal: The user's objective (e.g., "Build a writing assistant that learns my style").
constraints: Optional limits (e.g., "Must be lightweight").
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | ||
| constraints | No |
Implementation Reference
- The main handler function for the 'design_context_architecture' tool, decorated with @mcp.tool(). It validates input using DesignArchitectureInput, applies heuristic logic based on the goal and constraints to generate a blueprint of context system components (molecules, cells, organs, cognitive models), and returns the blueprint as a dictionary.@mcp.tool() def design_context_architecture(goal: str, constraints: str | None = None) -> dict: """ Architects a custom context system based on a high-level goal (The Architect). Returns a blueprint of Sutra components (Molecules, Cells, Organs, Thinking Models). Use this when the user wants to build a persistent agent or complex workflow rather than solving a single immediate task. Args: goal: The user's objective (e.g., "Build a writing assistant that learns my style"). constraints: Optional limits (e.g., "Must be lightweight"). """ try: model = DesignArchitectureInput(goal=goal, constraints=constraints) except ValidationError as e: return {"error": str(e)} g = model.goal.lower() c = (model.constraints or "").lower() # Blueprint Defaults blueprint: dict[str, Any] = { "name": "Custom System", "rationale": "General purpose context structure.", "components": { "molecule": "Standard CoT", "cell": "cell.protocol.key_value", "organ": None, "cognitive": "reasoning.understand_question", }, } if "lightweight" in c: blueprint["name"] += " (Light)" # Heuristic Architecture Logic if "debate" in g or "perspective" in g: blueprint["name"] = "Debate System" blueprint["components"]["organ"] = "organ.debate_council" blueprint["rationale"] = "Uses a multi-perspective organ to balance viewpoints." elif "research" in g or "report" in g or "synthesize" in g: blueprint["name"] = "Research Engine" blueprint["components"]["organ"] = "organ.research_synthesis" blueprint["components"]["cell"] = ( "cell.protocol.episodic" # Log research trails ) blueprint["rationale"] = ( "Combines a synthesis organ with episodic memory to track findings." ) elif "learn" in g or "remember" in g or "style" in g: blueprint["name"] = "Adaptive Assistant" blueprint["components"]["cell"] = "cell.protocol.windowed" blueprint["rationale"] = ( "Uses windowed memory to maintain recent context and style." ) elif "code" in g or "bug" in g or "review" in g: blueprint["name"] = "Code Auditor" blueprint["components"]["cognitive"] = "reasoning.verify_logic" blueprint["rationale"] = "Focuses on logic verification for code correctness." return blueprint
- Pydantic input schema (BaseModel) for the design_context_architecture tool, defining 'goal' (required string, min length 5) and optional 'constraints' fields.class DesignArchitectureInput(BaseModel): goal: str = Field( ..., min_length=5, description="The goal of the system to design." ) constraints: str | None = Field( None, description="Optional constraints or preferences." )