Documentation Banner

Documentation

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 matter
2import { UnifiedTEEAgent, TEESigner } from 'tee-agent-network';
3
4// Create signer (development or production mode)
5const signer = new TEESigner({ mode: 'development' });
6await signer.connect();
7
8// Create agent - mode determines ALL settings internally
9const agent = new UnifiedTEEAgent('MyAgent', signer, 'production');
10
11// Start with optional network settings (only these can be customized)
12await agent.start({
13 port: 9001, // Optional: specific port
14 bootstrapNodes: [ // Optional: bootstrap peers
15 '/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 parameters
2const agent = new UnifiedTEEAgent(
3 name: string, // Agent identifier
4 signer: TEESigner, // TEE signer instance
5 mode: 'development' | 'production' | 'test' // Determines ALL settings
6);
7
8// Start method options
9await 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 mode
npm run agent -- --mode production
npm run agent -- --mode test
# With network settings
npm run agent -- \
--name Alice \
--port 9001 \
--mode production \
--bootstrap /ip4/127.0.0.1/tcp/9000/p2p/...
# Bridge mode with WebSocket server
npm run bridge # Starts agent with WebSocket bridge on port 8080
# Environment variables (for bridge mode)
AGENT_MODE=production npm run bridge
AGENT_NAME=MyAgent npm run bridge
AGENT_PORT=9100 npm run bridge
BRIDGE_PORT=8080 npm run bridge

Environment Variables

Optional environment variables for runtime configuration (primarily for bridge mode):

# Agent Mode
AGENT_MODE=development # or 'production', 'test'
AGENT_NAME=BridgedAgent # Agent name
AGENT_PORT=9100 # P2P port
# Bridge Server (when using WebSocket bridge)
BRIDGE_PORT=8080
BRIDGE_AUTH_TOKEN=secret-token
BRIDGE_AUTH_REQUIRED=true
# TEE Signer Mode (independent of agent mode)
TEE_MODE=development # or 'production'
# Logging
LOG_LEVEL=info # debug, info, warn, error
DEBUG=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 // Attestation
5 attestationRequired: false,
6 attestationMockAllowed: true,
7 minTrustScore: 0,
8
9 // Timeouts (ms)
10 messageTimeout: 30000,
11 taskTimeout: 300000,
12 dialTimeout: 10000,
13
14 // Limits
15 maxConnections: 50,
16 maxMessageRate: 100,
17 maxTaskSize: 1048576, // 1MB
18
19 // Discovery
20 announceInterval: 30, // seconds
21 announcementTTL: 300000, // 5 minutes
22
23 // Security
24 rateLimitEnabled: true,
25 replayProtectionEnabled: true
26 },
27
28 production: {
29 // Attestation
30 attestationRequired: true,
31 attestationMockAllowed: false,
32 minTrustScore: 50,
33
34 // Timeouts (ms)
35 messageTimeout: 15000,
36 taskTimeout: 180000,
37 dialTimeout: 5000,
38
39 // Limits
40 maxConnections: 100,
41 maxMessageRate: 50,
42 maxTaskSize: 1048576,
43
44 // Discovery
45 announceInterval: 60, // seconds
46 announcementTTL: 600000, // 10 minutes
47
48 // Security
49 rateLimitEnabled: true,
50 replayProtectionEnabled: true
51 },
52
53 test: {
54 // Attestation
55 attestationRequired: false,
56 attestationMockAllowed: true,
57 minTrustScore: 0,
58
59 // Timeouts (ms)
60 messageTimeout: 5000,
61 taskTimeout: 10000,
62 dialTimeout: 1000,
63
64 // Limits
65 maxConnections: 10,
66 maxMessageRate: 1000,
67 maxTaskSize: 10240, // 10KB
68
69 // Discovery
70 announceInterval: 5, // seconds
71 announcementTTL: 60000, // 1 minute
72
73 // Security
74 rateLimitEnabled: false,
75 replayProtectionEnabled: true
76 }
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