Configuration
Simplified Mode-Based Configuration
TEE Agents use a simplified configuration system based on modes. Simply specify the mode when creating an agent and all internal settings are automatically configured. Individual settings cannot be overridden - the mode determines everything.
1// Creating an agent - only name and mode matter2import { UnifiedTEEAgent, TEESigner } from 'tee-agent-network';34// Create signer (development or production mode)5const signer = new TEESigner({ mode: 'development' });6await signer.connect();78// Create agent - mode determines ALL settings internally9const agent = new UnifiedTEEAgent('MyAgent', signer, 'production');1011// Start with optional network settings (only these can be customized)12await agent.start({13 port: 9001, // Optional: specific port14 bootstrapNodes: [ // Optional: bootstrap peers15 '/ip4/127.0.0.1/tcp/9000/p2p/...'16 ]17});
Available Modes
Important: Modes determine all internal behavior settings automatically. You cannot override individual settings like timeouts, limits, or attestation requirements. Choose the mode that best fits your use case.
Development Mode
Relaxed settings for local development and testing. Mock attestations allowed, no trust requirements.
const agent = new UnifiedTEEAgent('DevAgent', signer, 'development');// Automatic internal settings (not configurable):// - Attestation: Optional (mock allowed)// - Trust Score: 0 (no minimum)// - Message Timeout: 30s// - Task Timeout: 5min// - Max Message Rate: 100/min// - Discovery Interval: 30s// - No POW required
Production Mode
Strict security and performance settings for production environments. Real TEE required.
const agent = new UnifiedTEEAgent('ProdAgent', signer, 'production');// Automatic internal settings (not configurable):// - Attestation: Required (no mocks)// - Min Trust Score: 50// - Message Timeout: 15s// - Task Timeout: 3min// - Max Message Rate: 50/min// - Discovery Interval: 60s// - Stricter DOS protection
Test Mode
Fast timeouts and high limits for automated testing. Not for production use.
const agent = new UnifiedTEEAgent('TestAgent', signer, 'test');// Automatic internal settings (not configurable):// - Attestation: Optional// - Trust Score: 0// - Message Timeout: 5s// - Task Timeout: 10s// - Max Message Rate: 1000/min// - Discovery Interval: 5s// - No rate limiting
What You Can Configure
The agent constructor and start method only accept these parameters:
1// Constructor parameters2const agent = new UnifiedTEEAgent(3 name: string, // Agent identifier4 signer: TEESigner, // TEE signer instance5 mode: 'development' | 'production' | 'test' // Determines ALL settings6);78// Start method options9await agent.start({10 port?: number, // P2P port (optional, auto-assigned if not set)11 bootstrapNodes?: string[], // Bootstrap peers (optional)12 announceAddresses?: string[] // Addresses to announce (optional)13});
Command Line Usage
# Start in development mode (default)npm run agent# Start in specific modenpm run agent -- --mode productionnpm run agent -- --mode test# With network settingsnpm run agent -- \--name Alice \--port 9001 \--mode production \--bootstrap /ip4/127.0.0.1/tcp/9000/p2p/...# Bridge mode with WebSocket servernpm run bridge # Starts agent with WebSocket bridge on port 8080# Environment variables (for bridge mode)AGENT_MODE=production npm run bridgeAGENT_NAME=MyAgent npm run bridgeAGENT_PORT=9100 npm run bridgeBRIDGE_PORT=8080 npm run bridge
Environment Variables
Optional environment variables for runtime configuration (primarily for bridge mode):
# Agent ModeAGENT_MODE=development # or 'production', 'test'AGENT_NAME=BridgedAgent # Agent nameAGENT_PORT=9100 # P2P port# Bridge Server (when using WebSocket bridge)BRIDGE_PORT=8080BRIDGE_AUTH_TOKEN=secret-tokenBRIDGE_AUTH_REQUIRED=true# TEE Signer Mode (independent of agent mode)TEE_MODE=development # or 'production'# LoggingLOG_LEVEL=info # debug, info, warn, errorDEBUG=true # Enable debug output# Blockchain (optional, not fully implemented)RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR-KEY
Mode Settings Reference
These are the internal settings automatically applied by each mode. They cannot be individually overridden.
1// Internal settings determined by mode (not directly configurable)2const MODE_SETTINGS = {3 development: {4 // Attestation5 attestationRequired: false,6 attestationMockAllowed: true,7 minTrustScore: 0,89 // Timeouts (ms)10 messageTimeout: 30000,11 taskTimeout: 300000,12 dialTimeout: 10000,1314 // Limits15 maxConnections: 50,16 maxMessageRate: 100,17 maxTaskSize: 1048576, // 1MB1819 // Discovery20 announceInterval: 30, // seconds21 announcementTTL: 300000, // 5 minutes2223 // Security24 rateLimitEnabled: true,25 replayProtectionEnabled: true26 },2728 production: {29 // Attestation30 attestationRequired: true,31 attestationMockAllowed: false,32 minTrustScore: 50,3334 // Timeouts (ms)35 messageTimeout: 15000,36 taskTimeout: 180000,37 dialTimeout: 5000,3839 // Limits40 maxConnections: 100,41 maxMessageRate: 50,42 maxTaskSize: 1048576,4344 // Discovery45 announceInterval: 60, // seconds46 announcementTTL: 600000, // 10 minutes4748 // Security49 rateLimitEnabled: true,50 replayProtectionEnabled: true51 },5253 test: {54 // Attestation55 attestationRequired: false,56 attestationMockAllowed: true,57 minTrustScore: 0,5859 // Timeouts (ms)60 messageTimeout: 5000,61 taskTimeout: 10000,62 dialTimeout: 1000,6364 // Limits65 maxConnections: 10,66 maxMessageRate: 1000,67 maxTaskSize: 10240, // 10KB6869 // Discovery70 announceInterval: 5, // seconds71 announcementTTL: 60000, // 1 minute7273 // Security74 rateLimitEnabled: false,75 replayProtectionEnabled: true76 }77}
Understanding Modes
When to Use Each Mode
- Development: Local development, testing integrations, learning the system. No real TEE hardware required.
- Production: Real deployments with actual TEE hardware, strict security, and attestation requirements.
- Test: Automated testing, CI/CD pipelines. Fast timeouts for quick test execution.
Important Limitations
- • You cannot mix settings from different modes
- • Individual timeout or limit overrides are not supported
- • Mode must be chosen at agent creation time
- • TEE signer mode is independent of agent mode
