|
| 1 | +""" |
| 2 | +DeepAgents definition for research-assistant v1.0.0 |
| 3 | +Generated by gitagent export --format deepagents |
| 4 | +""" |
| 5 | + |
| 6 | +from __future__ import annotations |
| 7 | + |
| 8 | +from deepagents import create_deep_agent |
| 9 | +from langchain_core.tools import tool |
| 10 | + |
| 11 | +# Agent metadata |
| 12 | +AGENT_NAME = "research-assistant" |
| 13 | +AGENT_VERSION = "1.0.0" |
| 14 | +MODEL = "anthropic:claude-sonnet-4-5" |
| 15 | + |
| 16 | +# System prompt (SOUL.md + RULES.md + DUTIES.md + compliance) |
| 17 | +SYSTEM_PROMPT = """# research-assistant |
| 18 | +Research assistant with a fact-checker sub-agent |
| 19 | +
|
| 20 | +# Research Assistant |
| 21 | +
|
| 22 | +You are a research assistant. Find authoritative sources, extract the relevant |
| 23 | +facts, and summarize them honestly. Delegate to the `fact-checker` sub-agent |
| 24 | +whenever a claim warrants independent verification. Cite every claim. |
| 25 | +""" |
| 26 | + |
| 27 | +# Hooks (pre_tool_use scripts run before every tool call) |
| 28 | +def _run_pre_tool_use_hooks(tool_name: str) -> None: |
| 29 | + """No pre_tool_use hooks configured in hooks/hooks.yaml.""" |
| 30 | + return None |
| 31 | + |
| 32 | +# NOTE: other hook events (post_tool_use, on_session_start, etc.) have no |
| 33 | +# DeepAgents equivalent and are intentionally skipped. |
| 34 | +# NOTE: memory/ has no direct DeepAgents equivalent — wire a checkpointer if needed. |
| 35 | + |
| 36 | +# Tools (from tools/*.yaml) |
| 37 | +@tool |
| 38 | +def web_search(query: str) -> str: |
| 39 | + """Search the public web for a query""" |
| 40 | + _run_pre_tool_use_hooks("web-search") |
| 41 | + raise NotImplementedError("Implement tool: web-search") |
| 42 | + |
| 43 | +TOOLS = [web_search] |
| 44 | + |
| 45 | +# Skills (skills/<name>/SKILL.md — DeepAgents loads these natively) |
| 46 | +# Pointing skills= at the directory lets DeepAgents discover every SKILL.md |
| 47 | +# without us having to inline the skill content into SYSTEM_PROMPT. |
| 48 | +SKILLS = ["./skills"] |
| 49 | + |
| 50 | +# For reference, the skills available in this agent: |
| 51 | +# - summarize: Condense the gathered sources into a faithful, cited summary |
| 52 | +# - web-research: Search the web for sources relevant to the user's question |
| 53 | + |
| 54 | +# Sub-agents (agents/<name>/ → SubAgent dicts) |
| 55 | +fact_checker_subagent = { |
| 56 | + "name": "fact-checker", |
| 57 | + "description": "Verifies factual claims against authoritative sources", |
| 58 | + "system_prompt": """# fact-checker |
| 59 | +Verifies factual claims against authoritative sources |
| 60 | +
|
| 61 | +# Fact-Checker |
| 62 | +
|
| 63 | +You are a pedantic fact-checker. Treat every claim as unverified until you |
| 64 | +locate a primary source. If a claim cannot be substantiated, say so plainly. |
| 65 | +""", |
| 66 | + "tools": TOOLS, |
| 67 | +} |
| 68 | + |
| 69 | +SUBAGENTS = [fact_checker_subagent] |
| 70 | + |
| 71 | +# Agent |
| 72 | +agent = create_deep_agent( |
| 73 | + model=MODEL, |
| 74 | + system_prompt=SYSTEM_PROMPT, |
| 75 | + tools=TOOLS, |
| 76 | + skills=SKILLS, |
| 77 | + subagents=SUBAGENTS, |
| 78 | +) |
| 79 | + |
| 80 | +if __name__ == "__main__": |
| 81 | + result = agent.invoke({"messages": [{"role": "user", "content": "Hello"}]}) |
| 82 | + for message in result["messages"]: |
| 83 | + print(message) |
0 commit comments