Agent (Entity)
Agent Module
Entíty_Córe // Autónomous_Únit
ᚠ ᛫ ᛟ ᛫ ᚱ ᛫ ᛒ ᛫ ᛟ ᛫ ᚲ
The Agent module is the heart of the ForbocAI SDK. An Agent is an autonomous entity with a persona, internal state, and memory that can process inputs and generate contextual responses.
T̶h̷e̸y̵ ̸a̸r̶e̵ ̷n̶o̵t̸ ̷s̶c̸r̸i̵p̴t̴e̴d̷.̵ ̸T̶h̷e̶y̵ ̵a̵r̶e̷ ̸b̶o̷r̴n̵.̶
Features
- Pure Functional: Uses factory pattern with closures, no classes
- State Immutability: Agent state is never mutated; new versions are returned
- Cortex Integration: Connects to local SLM for text generation
- Memory Recall: Automatically retrieves relevant memories during processing
- Action Validation: Works with Bridge module to ensure valid outputs
Core Concepts
Agent State
Every agent maintains internal state that influences behavior:
Agent Response
When processing input, agents return structured responses:
Usage
Creating an Agent
Use the createAgent factory function (never use new):
Processing Input
Agents process player input and generate contextual responses:
State Management
Access and update agent state (immutably):
Exporting to Soul
Export the agent’s complete being for persistence or portability:
Importing from Soul
Reconstruct an agent from a previously exported Soul:
API Integration
The Agent module communicates with the ForbocAI API to get behavioral directives:
- Agent receives player input
- Agent sends context to API
- API returns behavioral directive (pure logic)
- Agent uses Cortex to generate response based on directive
- Agent returns structured response
Best Practices
1. Descriptive Personas
Write detailed, character-driven personas:
2. Initialize Cortex Once
Share a single Cortex instance across multiple agents:
3. Track Relationships
Use the relationships map to enable dynamic NPC behavior:
Type Reference
ᚠ ᛫ ᛟ ᛫ ᚱ ᛫ ᛒ ᛫ ᛟ ᛫ ᚲ
T̴h̵e̷ ̴v̶e̴s̵s̸e̶l̶s̷ ̴a̷w̸a̷i̶t̶ ̸t̶h̴e̵i̵r̸ ̶p̸u̶r̴p̸o̴s̸e̵.̸
