Core Concepts
Understanding the fundamental building blocks of Spice Framework.
Architectureβ
Spice Framework is built on four core concepts:
Agent β Comm β Tool β Registry
1. Agentβ
An autonomous unit that processes messages and performs actions. Agents can:
- Handle incoming communications
- Execute tools
- Maintain state
- Interact with other agents
2. Comm (Communication)β
The unified message format for all agent interactions. Replaces legacy Message systems with:
- Type-safe enums for message types
- Rich metadata support
- Media attachments
- Priority and TTL
3. Toolβ
Reusable functions that agents can execute. Tools provide:
- Parameter validation
- Type checking
- Async execution
- Error handling
4. Registryβ
Thread-safe, type-safe management of components:
- AgentRegistry - Manage agents
- ToolRegistry - Organize tools
- FlowRegistry - Coordinate workflows
How They Work Togetherβ
// 1. Create an agent
val agent = buildAgent {
id = "processor"
// 2. Add tools
tool("process") { /* ... */ }
// 3. Handle communications
handle { comm ->
// 4. Execute tools
val result = run("process", params)
comm.reply(result.result, id)
}
}
// 5. Register in registry
AgentRegistry.register(agent)
Next Stepsβ
Dive deeper into each concept: