Implement the CREATE primitive for spawning child actors with narrowed capabilities.
Overview
This is Phase 2 of the actor-native agent orchestration system. CREATE allows agents to spawn child actors to handle subtasks, with capabilities that are equal to or narrower than the parent's.
Requirements
Create Tool
Add a create tool to the agent toolset:
create:
description: Create a child actor to handle part of the work
parameters:
task: Initial task description for the child (required)
capabilities:
tools: List of allowed tools (subset of parent's tools)
cost_limit: Max spend in dollars (<= parent's remaining budget)
files: List of {path, mode} for file access
customer: Who should receive the result (defaults to self)
Actor Identity
- Generate unique actor_id for each new actor (use existing RunId generation)
- Actor knows its own ID, parent's ID, and customer's ID
- These are passed via environment or initial message
Capability Narrowing
- Child capabilities must be <= parent capabilities
- Validate at creation time, reject if child tries to exceed parent
- Capabilities are passed to child container as config
Child Lifecycle
- Parent calls create tool
- System spawns new container with child's config
- System sends initial message to child with task
- Child processes messages until complete
- Child sends result to its customer
Actor Graph Tracking
- Track parent -> children relationships
- Needed for: cost aggregation, termination detection, debugging
- Store in
_/actors/{actor_id}.json or similar
Implementation Notes
Files to modify/create
Omni/Agent/Actor.hs - CREATE implementation, capability validationOmni/Agent/Tools.hs - Add create toolOmni/Agentd.hs - Container spawning for child actors
Container Spawning
- Reuse existing container infrastructure from agentd
- Pass actor_id, parent_id, customer_id as env vars
- Pass capabilities as mounted config file
Testing
- Test capability narrowing validation
- Test child receives initial message
- Test actor graph tracking
- Test cost aggregation across parent/child
Dependencies
- Task: Actor model: Message passing infrastructure (for initial message to child)
References
- Spec:
_/llm/actors.md (CREATE primitive, Capability Narrowing section) - Container infra:
Omni/Agentd.hs