Design and implement a production-ready agent system:
Architecture Components:
- Orchestrator: Central task dispatch
- Memory: Tiered storage (STM/LTM/Vector)
- Tool Registry: Sandboxed execution
- Safety: Multi-layer guardrails
- Observability: Metrics, logging, tracing
Requirements:
initialize_components(): Set up all subsystemsexecute_task(task, context): Full execution pipeline- Generate trace_id
- Run safety checks
- Execute with observability
- Return result + metrics
health_check(): Verify all components healthygraceful_shutdown(): Clean resource cleanup
Production Considerations:
- Circuit breakers on external calls
- Token budget enforcement
- Rate limiting
- Error recovery
- Audit logging
Examples
Example 1:
Input:
config = {'max_tokens': 1000, 'timeout': 30}; system = ProductionAgentSystem(config); system.initialize_components(); 'orchestrator' in system.componentsOutput:
TrueExplanation: System initialized with orchestrator component
Starter Code
class ProductionAgentSystem:
"""
Design a production-ready agent system with all components.
This is a system design implementation.
"""
def __init__(self, config):
self.config = config
self.components = {}
self.health_status = {}
def initialize_components(self):
"""
Initialize all system components:
- Agent orchestrator
- Memory systems (short/long-term)
- Tool registry with sandboxing
- Safety guardrails
- Observability
"""
# Your implementation here
pass
def execute_task(self, task, context=None):
"""
Execute task with full observability and safety.
Returns {'result': ..., 'trace_id': ..., 'metrics': ...}
"""
# Your implementation here
pass
def health_check(self):
"""Check health of all components"""
# Your implementation here
pass
def graceful_shutdown(self):
"""Gracefully shutdown all components"""
# Your implementation here
passPython3
ReadyLines: 1Characters: 0
Ready