π¦
Copilot Agent SDK Python
No description available
0 installs
Trust: 30 β Low
Devtools
Ask AI about Copilot Agent SDK Python
Powered by Claude Β· Grounded in docs
I know everything about Copilot Agent SDK Python. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Loading tools...
Reviews
Documentation
Copilot Agent SDK (Python)
A Python SDK for building autonomous agents with GitHub Copilot CLI, inspired by Claude Agent SDK.
π Features
- π€ Programmatic Control: Use Copilot CLI from your Python code
- π Workflow Engine: Chain multiple AI operations seamlessly
- π‘οΈ Permission Management: Granular control with
--allow-*flags - π MCP Integration: Connect to MCP servers programmatically
- πΎ Persistent Memory: Neo4j memory support for cross-session context
- π Streaming: Real-time progress updates
- π― Agent Templates: Pre-built agents for common tasks
π¦ Installation
pip install copilot-agent-sdk
Or install from source:
git clone https://github.com/yourusername/copilot-agent-sdk-python.git
cd copilot-agent-sdk-python
pip install -e .
π― Quick Start
Basic Usage
import asyncio
from copilot_agent_sdk import CopilotAgent
async def main():
# Create agent with autonomous permissions
agent = CopilotAgent(allow_all_tools=True, allow_all_paths=True)
# Execute a prompt
result = await agent.execute("create a FastAPI server with tests")
print(f"Success: {result.success}")
print(f"Output: {result.output}")
asyncio.run(main())
Granular Permissions
from copilot_agent_sdk import CopilotAgent, PermissionConfig
# Safe mode - read-only
agent = CopilotAgent(permissions=PermissionConfig.safe())
# Custom permissions
agent = CopilotAgent()
agent.allow_tool('shell(git:*)') # Allow all git commands
agent.deny_tool('shell(git push)') # Except push
agent.add_directory('/tmp/sandbox') # Specific directory
result = await agent.execute("analyze git history")
Workflows
from copilot_agent_sdk import CopilotWorkflow
workflow = CopilotWorkflow("CI/CD Pipeline")
workflow.add_step("test", "run all unit tests")
workflow.add_step("lint", "check code style with ruff")
workflow.add_step("build", "build Docker image")
workflow.add_step("deploy", "deploy to staging")
results = await workflow.run(autonomous=True)
for step, result in results:
print(f"{step.name}: {'β
' if result.success else 'β'}")
Custom Tools
from copilot_agent_sdk import tool, create_mcp_server
@tool(
name='search_docs',
description='Search internal documentation',
input_schema={'query': str, 'limit': int}
)
async def search_docs(params):
# Your custom logic
results = await search_database(params['query'], params['limit'])
return {'content': results}
# Create MCP server
server = create_mcp_server([search_docs])
# Use in agent
agent = CopilotAgent(mcp_servers=[server])
result = await agent.execute("search docs for authentication")
With Memory
from copilot_agent_sdk import CopilotAgent, Neo4jMemory
agent = CopilotAgent(
memory=Neo4jMemory(
uri='bolt://localhost:7687',
username='neo4j',
password='password',
namespace='my-project'
)
)
# Agent remembers across sessions
await agent.execute("remember: our API uses JWT tokens")
# Later...
result = await agent.execute("what authentication does our API use?")
# Agent recalls: "JWT tokens"
π Documentation
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββ
β Your Application β
βββββββββββββββ¬ββββββββββββββββββββββββ
β
βββββββββββββββΌββββββββββββββββββββββββ
β Copilot Agent SDK β
β βββββββββββ ββββββββββββββββββββ β
β β Agent β β Permission β β
β β Manager β β Manager β β
β βββββββββββ ββββββββββββββββββββ β
β βββββββββββ ββββββββββββββββββββ β
β βWorkflow β β MCP Integration β β
β β Engine β β β β
β βββββββββββ ββββββββββββββββββββ β
βββββββββββββββ¬ββββββββββββββββββββββββ
β
βββββββββββββββΌββββββββββββββββββββββββ
β GitHub Copilot CLI β
βββββββββββββββββββββββββββββββββββββββ
π¨ Examples
Check out the examples directory for more:
π§ͺ Testing
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# With coverage
pytest --cov=copilot_agent_sdk --cov-report=html
π€ Contributing
Contributions are welcome! Please read CONTRIBUTING.md for details.
π License
MIT License - see LICENSE for details.
π Acknowledgments
- Inspired by Claude Agent SDK
- Built on GitHub Copilot CLI
- Powered by Model Context Protocol (MCP)
π Support
Made with β€οΈ by the community
