Skip to content

Conversation

@ashwin-ant
Copy link
Collaborator

Summary

  • Add support for custom agent definitions via agents option
  • Add support for controlling setting sources via setting_sources option
  • Add examples demonstrating both features
  • Add e2e tests for verification

Changes

Core Implementation

  • Add AgentDefinition and SettingSource types to types.py
  • Add agents and setting_sources fields to ClaudeCodeOptions
  • Update subprocess CLI transport to pass --agents and --setting-sources flags
  • Handle empty setting_sources array correctly (pass empty string to CLI)

Examples

  • examples/agents.py: Demonstrates custom agent definitions with different tools and models
  • examples/setting_sources.py: Shows how to control which settings are loaded (user/project/local)

Tests

  • Add e2e tests verifying agents and setting sources functionality
  • Tests use temporary directories for isolated testing

Test Plan

  • E2E tests pass locally
  • CI tests pass
  • Examples run successfully

🤖 Generated with Claude Code

ashwin-ant and others added 4 commits September 25, 2025 09:56
Add support for custom agent definitions and setting sources control,
matching the TypeScript SDK implementation.

- Add AgentDefinition type with description, prompt, tools, and model
- Add SettingSource type for controlling which settings to load
- Update ClaudeCodeOptions with agents and setting_sources fields
- Pass --agents and --setting-sources flags to CLI subprocess
- Add agents.py example demonstrating custom agent usage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add example demonstrating how setting_sources controls which settings
are loaded (user, project, local) and affects available slash commands.

- Add setting_sources.py example with three scenarios
- Fix subprocess_cli to handle empty setting_sources array (pass empty string)
- Example shows how project commands are excluded/included based on sources

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add end-to-end tests verifying agents and setting_sources functionality
with real CLI interactions.

- Test custom agent definitions are passed through
- Test setting_sources=["user"] excludes project settings
- Test setting_sources=["user", "project"] includes project settings
- Use temporary directories for isolated testing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ashwin-ant ashwin-ant closed this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants