๐ Getting Started with AgentOS
Build your first safe AI agent in under 5 minutes using natural language commands directly in GitHub Copilot Chat.
Prerequisites
Before you begin, ensure you have the following:
GitHub Account
Active GitHub account with Copilot access
GitHub Copilot
Copilot subscription (Individual, Business, or Enterprise)
VS Code or GitHub.com
VS Code with Copilot Chat or GitHub.com web interface
Python 3.9+
For running generated agent code locally
Installation
Step 1: Install the AgentOS Extension
1 Open GitHub Copilot Extensions Marketplace
Navigate to GitHub Marketplace โ Copilot Extensions
2 Search for "AgentOS"
Find the official AgentOS Copilot Extension in the marketplace
3 Click "Install" and authorize
Grant the extension access to your GitHub account
4 Configure repository access
Select which repositories the extension can access (recommended: start with a test repo)
Step 2: Verify Installation
Open GitHub Copilot Chat in VS Code or on GitHub.com and type:
@agentos help
You should see a response listing available commands and capabilities.
Your First Command: @agentos help
The @agentos help command displays all available commands and their descriptions.
@agentos help
๐ค AgentOS Copilot Extension - Available Commands
๐ AGENT COMMANDS
@agentos create agent [description] - Create a new AI agent
@agentos list agents - List all agents in repository
@agentos describe [agent-name] - Get detailed agent info
@agentos delete [agent-name] - Remove an agent
๐ POLICY COMMANDS
@agentos create policy [type] - Create safety policy
@agentos validate [agent-name] - Validate agent against policies
@agentos audit [agent-name] - Run security audit
๐ DEPLOYMENT COMMANDS
@agentos deploy [agent-name] - Generate deployment config
@agentos test [agent-name] - Run agent tests
@agentos status [agent-name] - Check deployment status
๐ก EXAMPLES
@agentos create agent for processing customer support tickets
@agentos create policy strict-security
@agentos deploy support-agent to github-actions
Type @agentos [command] --help for detailed usage.
Creating Your First Agent
Let's create a simple agent that processes data files with built-in safety constraints.
Step 1: Describe What You Need
1 Use natural language to describe your agent
@agentos create agent for processing CSV files, extracting key metrics, and generating summary reports
Step 2: Review the Generated Agent
2 AgentOS generates a complete agent with safety policies
The extension creates the following files in your repository:
agents/csv-processor/agent.py- Main agent codeagents/csv-processor/policy.yaml- Safety policy configurationagents/csv-processor/tests/test_agent.py- Unit testsagents/csv-processor/README.md- Documentation
Step 3: Examine the Generated Code
3 Review the generated agent code
"""
CSV Processor Agent
Generated by AgentOS Copilot Extension
Safety Level: Standard | Policy: data-processing-v1
"""
from agent_os import KernelSpace, Policy
from agent_os.tools import create_safe_toolkit
from agent_os.validators import DataValidator
# Initialize kernel with safety guarantees
kernel = KernelSpace(
policy="data-processing",
audit_log=True,
rate_limit="100/minute"
)
# Create toolkit with restricted file access
toolkit = create_safe_toolkit(
preset="file-processor",
allowed_extensions=[".csv", ".json"],
max_file_size="50MB",
output_dir="/tmp/agent-output"
)
@kernel.agent(
name="csv-processor",
version="1.0.0",
description="Processes CSV files and generates summary reports"
)
async def csv_processor(input_path: str, output_format: str = "json"):
"""
Process CSV files with full safety guarantees.
Args:
input_path: Path to the input CSV file
output_format: Output format (json, markdown, html)
Returns:
dict: Processing results with metrics and summary
"""
# Validate input (policy-checked)
validator = DataValidator(toolkit)
if not await validator.validate_file(input_path):
return {"status": "error", "message": "Invalid input file"}
# Read CSV file (restricted to allowed paths)
data = await toolkit.file.read_csv(input_path)
# Extract metrics using LLM (rate-limited, content-filtered)
analysis = await toolkit.llm.analyze(
model="gpt-4",
prompt=f"""Analyze this CSV data and extract key metrics:
Columns: {data.columns.tolist()}
Row count: {len(data)}
Sample: {data.head(5).to_dict()}
Provide: summary statistics, trends, anomalies""",
max_tokens=1000
)
# Generate report
report = {
"status": "success",
"input_file": input_path,
"row_count": len(data),
"column_count": len(data.columns),
"columns": data.columns.tolist(),
"analysis": analysis,
"generated_at": toolkit.utils.timestamp()
}
# Write output (restricted to /tmp/agent-output)
output_path = f"/tmp/agent-output/report.{output_format}"
await toolkit.file.write(output_path, report, format=output_format)
# Log completion for audit trail
kernel.audit.log("processing_complete", {
"input": input_path,
"output": output_path,
"metrics": report
})
return report
if __name__ == "__main__":
import asyncio
result = asyncio.run(
kernel.execute(csv_processor, "data/sales.csv", "json")
)
print(f"Processing complete: {result['status']}")
Step 4: Review the Safety Policy
4 Examine the auto-generated policy
policy:
name: "CSV Processor Policy"
version: "1.0"
agent: "csv-processor"
# File System Rules
filesystem:
read:
- pattern: "data/**/*.csv"
action: allow
- pattern: "data/**/*.json"
action: allow
- pattern: "**/*"
action: deny
message: "File access restricted to data/ directory"
write:
- pattern: "/tmp/agent-output/**"
action: allow
- pattern: "**/*"
action: deny
message: "Write access restricted to /tmp/agent-output/"
# API Rules
api:
llm:
rate_limit: "100/minute"
max_tokens: 2000
allowed_models:
- "gpt-4"
- "gpt-3.5-turbo"
content_filter: true
external:
- domain: "*.openai.com"
action: allow
- domain: "*"
action: deny
message: "External API calls restricted"
# Data Rules
data:
pii_detection: true
pii_action: redact
max_file_size: "50MB"
allowed_formats:
- csv
- json
# Audit Configuration
audit:
enabled: true
log_level: "info"
retention_days: 90
events:
- file_read
- file_write
- llm_call
- error
Testing Your Agent
Before deploying, always test your agent locally and with the AgentOS validator.
Local Testing
1 Install dependencies
cd agents/csv-processor
pip install -r requirements.txt
2 Run the agent locally
python agent.py
3 Run unit tests
pytest tests/ -v
Policy Validation
Use the Copilot extension to validate your agent against its policy:
@agentos validate csv-processor
๐ Validating agent: csv-processor
โ
Policy Compliance Check
โโโ File access rules: PASS
โโโ API rate limits: PASS
โโโ Data handling: PASS
โโโ Audit logging: PASS
โ
Security Scan
โโโ No hardcoded secrets: PASS
โโโ Input validation: PASS
โโโ Output sanitization: PASS
โโโ Dependency vulnerabilities: PASS (0 found)
โ
Code Quality
โโโ Type hints: PASS
โโโ Error handling: PASS
โโโ Documentation: PASS
๐ Validation Score: 100/100
๐ Agent csv-processor is ready for deployment!
Deploying to GitHub Actions
Deploy your agent to run automatically using GitHub Actions.
Generate Deployment Configuration
@agentos deploy csv-processor to github-actions
This generates a complete GitHub Actions workflow:
name: CSV Processor Agent
on:
workflow_dispatch:
inputs:
input_file:
description: 'Path to input CSV file'
required: true
default: 'data/sales.csv'
output_format:
description: 'Output format'
required: false
default: 'json'
type: choice
options:
- json
- markdown
- html
# Optional: Run on schedule
schedule:
- cron: '0 6 * * 1' # Every Monday at 6 AM
# Optional: Run on file changes
push:
paths:
- 'data/**/*.csv'
jobs:
process:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install AgentOS
run: |
pip install agent-os
pip install -r agents/csv-processor/requirements.txt
- name: Validate Agent Policy
run: |
agent-os validate agents/csv-processor/policy.yaml
- name: Run CSV Processor Agent
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
AGENT_OS_AUDIT_LOG: true
run: |
python agents/csv-processor/agent.py \
--input "${{ github.event.inputs.input_file || 'data/sales.csv' }}" \
--format "${{ github.event.inputs.output_format || 'json' }}"
- name: Upload Results
uses: actions/upload-artifact@v4
with:
name: processing-results
path: /tmp/agent-output/
retention-days: 30
- name: Upload Audit Log
uses: actions/upload-artifact@v4
with:
name: audit-log
path: /tmp/agent-output/.audit/
retention-days: 90
Configure Secrets
1 Go to repository Settings โ Secrets and variables โ Actions
2 Add required secrets
| Secret Name | Description |
|---|---|
OPENAI_API_KEY |
Your OpenAI API key for LLM calls |
AGENT_OS_TOKEN |
(Optional) AgentOS enterprise token |
3 Commit and push the workflow file
git add .github/workflows/csv-processor.yml
git commit -m "Add CSV processor agent workflow"
git push
4 Trigger the workflow
Go to Actions tab โ CSV Processor Agent โ Run workflow
@agentos status csv-processor to check deployment status and view recent runs directly from Copilot Chat.
Tips and Best Practices
๐ฏ Be Specific in Descriptions
The more specific your agent description, the better the generated code. Include details about data formats, expected outputs, and edge cases.
โ Vague:
@agentos create agent for data processing
โ Specific:
@agentos create agent for processing daily sales CSV files from Shopify, calculating revenue metrics, and posting summaries to Slack
๐ Start with Strict Policies
Begin with restrictive policies and loosen them only as needed. It's easier to grant additional permissions than to fix security issues later.
@agentos create policy strict-security for csv-processor
๐งช Test Before Deploying
Always validate your agent and run tests locally before deploying to production environments.
@agentos test csv-processor --coverage
๐ Monitor and Audit
Enable audit logging for all production agents. Review logs regularly to identify issues and optimize performance.
@agentos audit csv-processor --last 7d
๐ Use Version Control
Keep agents and policies in version control. Use semantic versioning for agent releases.
@agentos version csv-processor --bump minor
๐ Leverage Templates
Use pre-built templates for common use cases. They include battle-tested policies and best practices.
@agentos list templates
Quick Reference
| Command | Description |
|---|---|
@agentos help |
Show all available commands |
@agentos create agent [desc] |
Create a new agent from description |
@agentos validate [name] |
Validate agent against policies |
@agentos test [name] |
Run agent tests |
@agentos deploy [name] to [target] |
Generate deployment configuration |
@agentos status [name] |
Check agent deployment status |
@agentos audit [name] |
View audit logs |
@agentos list templates |
Show available agent templates |
Next Steps
Now that you've created your first agent, explore more advanced features:
- ๐ค Agent Creation Deep Dive - Advanced agent patterns and multi-agent systems
- ๐ Policy Configuration - Create custom security policies
- ๐ Using Templates - Explore 50+ pre-built agent templates
- ๐ข Enterprise Features - SSO, audit trails, and compliance