Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,229 changes: 1,015 additions & 214 deletions claude_agent_sdk/00_The_one_liner_research_agent.ipynb

Large diffs are not rendered by default.

2,349 changes: 2,203 additions & 146 deletions claude_agent_sdk/01_The_chief_of_staff_agent.ipynb

Large diffs are not rendered by default.

1,465 changes: 1,368 additions & 97 deletions claude_agent_sdk/02_The_observability_agent.ipynb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions claude_agent_sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ Each notebook includes an agent implementation in its respective directory:
- **`chief_of_staff_agent/`** - Multi-agent executive assistant with financial modeling and compliance
- **`observability_agent/`** - DevOps monitoring agent with GitHub integration

**Running standalone agents:** To import agent modules outside of notebooks, either run from the `claude_agent_sdk/` directory or install the package in editable mode:
```bash
uv pip install -e .
```

## Background
### The Evolution of Claude Agent SDK

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: budget-impact
description: Analyze the financial impact of a decision on budget, burn rate, and runway
---

Use the financial-analyst subagent to analyze the budget impact of: {{args}}
Use the financial-analyst subagent to analyze the budget impact of: $ARGUMENTS

Provide a comprehensive analysis including:
1. Total cost (one-time and recurring)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ name: slash-command-test
description: example of how a slash-command works
---

Reverse the following sentence word wise: {{args}}
Reverse the following sentence word wise: $ARGUMENTS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: strategic-brief
description: Generate a comprehensive strategic brief by coordinating analysis from both financial and talent perspectives
---

Create a strategic brief on: {{args}}
Create a strategic brief on: $ARGUMENTS

Coordinate with both the financial-analyst and recruiter subagents to provide:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: talent-scan
description: Scan the talent market for specific roles and provide hiring recommendations
---

Use the recruiter subagent to perform a talent market scan for: {{args}}
Use the recruiter subagent to perform a talent market scan for: $ARGUMENTS

Analyze and report on:
1. Talent availability in target markets
Expand Down
2 changes: 1 addition & 1 deletion claude_agent_sdk/chief_of_staff_agent/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- **HQ**: San Francisco, CA

## Financial Snapshot
- **Monthly Burn Rate**: $500,000
- **Monthly Burn Rate**: ~$500,000
- **Current Runway**: 20 months (until September 2025)
- **ARR**: $2.4M (growing 15% MoM)
- **Cash in Bank**: $10M
Expand Down
38 changes: 22 additions & 16 deletions claude_agent_sdk/chief_of_staff_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
load_dotenv()


def get_activity_text(msg) -> str | None:
def get_activity_text(msg: Any) -> str | None:
"""Extract activity text from a message"""
try:
if "Assistant" in msg.__class__.__name__:
Expand All @@ -31,7 +31,7 @@ def get_activity_text(msg) -> str | None:
return None


def print_activity(msg) -> None:
def print_activity(msg: Any) -> None:
"""Print activity to console"""
activity = get_activity_text(msg)
if activity:
Expand Down Expand Up @@ -78,27 +78,33 @@ async def send_query(
"""

# build options with optional output style
options_dict = {
"model": "claude-sonnet-4-5",
"allowed_tools": [
settings = None
if output_style:
settings = json.dumps({"outputStyle": output_style})

options = ClaudeAgentOptions(
model="claude-opus-4-5",
allowed_tools=[
"Task", # enables subagent delegation
"Read",
"Write",
"Edit",
"Bash",
"WebSearch",
],
"continue_conversation": continue_conversation,
"system_prompt": system_prompt,
"permission_mode": permission_mode,
"cwd": os.path.dirname(os.path.abspath(__file__)),
}

# add output style if specified
if output_style:
options_dict["settings"] = json.dumps({"outputStyle": output_style})

options = ClaudeAgentOptions(**options_dict)
continue_conversation=continue_conversation,
system_prompt=system_prompt,
permission_mode=permission_mode,
cwd=os.path.dirname(os.path.abspath(__file__)),
settings=settings,
# IMPORTANT: setting_sources must include "project" to load filesystem settings:
# - Slash commands from .claude/commands/
# - CLAUDE.md project instructions
# - Subagent definitions from .claude/agents/
# - Hooks from .claude/settings.local.json
# Without this, the SDK operates in isolation mode with no filesystem settings loaded.
setting_sources=["project", "local"],
)

result = None
messages = [] # this is to append the messages ONLY for this agent turn
Expand Down
16 changes: 16 additions & 0 deletions claude_agent_sdk/chief_of_staff_agent/audit/report_history.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@
"action": "created",
"word_count": 720,
"tool": "Write"
},
{
"timestamp": "2025-12-04T15:38:47.830538",
"file": "Q2_2024_Financial_Forecast_Report.md",
"path": "/home/rudycosta3/anthropic-cookbook/claude_agent_sdk/chief_of_staff_agent/output_reports/Q2_2024_Financial_Forecast_Report.md",
"action": "created",
"word_count": 956,
"tool": "Write"
},
{
"timestamp": "2025-12-04T15:47:56.409214",
"file": "hiring_decision.md",
"path": "/home/rudycosta3/anthropic-cookbook/claude_agent_sdk/chief_of_staff_agent/output_reports/hiring_decision.md",
"action": "created",
"word_count": 1943,
"tool": "Write"
}
]
}
16 changes: 16 additions & 0 deletions claude_agent_sdk/chief_of_staff_agent/audit/script_usage_log.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@
"description": "Calculate hiring impact for 3 engineers at $200K",
"tool_used": "Bash",
"success": true
},
{
"timestamp": "2025-12-04T15:38:06.071673",
"script": "simple_calculation.py",
"command": "python /home/rudycosta3/anthropic-cookbook/claude_agent_sdk/chief_of_staff_agent/scripts/simple_calculation.py 10000000 500000",
"description": "Run financial calculation script",
"tool_used": "Bash",
"success": true
},
{
"timestamp": "2025-12-04T15:44:06.248339",
"script": "hiring_impact.py",
"command": "python /home/rudycosta3/anthropic-cookbook/claude_agent_sdk/chief_of_staff_agent/scripts/hiring_impact.py 3 200000",
"description": "Calculate hiring impact for 3 senior engineers",
"tool_used": "Bash",
"success": true
}
]
}
Loading
Loading