Quick Start
Features
Context Storage
Store entity-specific context data
Context Retrieval
Retrieve context for any entity
Context Inheritance
Resolve context across organizational layers
Context Management
Update and delete entity context
Entity Types
The Context Service supports the following entity types:- agent: Individual agents
- team: Multi-agent teams
- environment: Runtime environments
- project: Project entities
- organization: Organization-level context
Get Context
Retrieve context for a specific entity:entity_type(str, required): Type of entity (‘agent’, ‘team’, ‘environment’, etc.)entity_id(str, required): UUID of the entity
Update Context
Update context for a specific entity:entity_type(str, required): Type of entityentity_id(str, required): UUID of the entitycontext_data(dict, required): Context data to store
Context updates replace the entire context for the entity. To merge with existing context, retrieve it first, merge locally, then update.
Delete Context
Clear or delete context for a specific entity:entity_type(str, required): Type of entityentity_id(str, required): UUID of the entity
Resolve Context
Resolve context with inheritance from all organizational layers:entity_type(str, required): Type of entityentity_id(str, required): UUID of the entity
Context Inheritance
Context inheritance follows organizational hierarchy:Complete Example
Here’s a complete example showing context management across entity types:Error Handling
Handle context-related errors:Use Cases
Configuration Management
Access Control
Monitoring & Observability
Cost Attribution
Best Practices
Context Organization
- Hierarchical Design: Use inheritance to avoid duplication
- Specific Overrides: Place specific values at lower levels
- Consistent Keys: Use consistent key names across entity types
- Avoid Deep Nesting: Keep context structure flat when possible
Data Management
- Regular Updates: Keep context data current
- Clean Up Unused: Delete context for deleted entities
- Validate Data: Validate context data before storing
- Version Context: Include version info in context for tracking changes
Security
- Sensitive Data: Avoid storing sensitive data in context (use Secrets Service instead)
- Access Control: Limit who can update context
- Audit Changes: Log all context changes
- Encrypt Sensitive Fields: Use encryption for any sensitive context data
Performance
- Cache Resolved Context: Cache resolved context for frequently accessed entities
- Batch Operations: When updating multiple entities, batch where possible
- Lazy Resolution: Use
get()instead ofresolve()when inheritance isn’t needed
API Reference
Next Steps
Agents Service
Manage agents with context
Teams Service
Configure team context
Environments Service
Set environment context
Secrets Service
Store sensitive data securely