Agent-TS Configuration
Agent-TS is configured through environment variables. Copy.env.example to .env and configure the required values.
Environment Variables
Required Variables
| Variable | Description | Example |
|---|---|---|
OPENAI_API_KEY | OpenAI API key for GPT and Vision | sk-... |
GATEWAY_API_KEY | OLIVE Gateway API key | olive_live_xxx... |
WHATSAPP_VERIFY_TOKEN | Webhook verification token | your-verify-token |
Optional Variables
| Variable | Description | Default |
|---|---|---|
PORT | Server port | 8000 |
OPENAI_MODEL | OpenAI model to use | gpt-4o-mini |
OPENAI_ASSISTANT_ID | Existing assistant ID | Auto-created |
GATEWAY_URL | Gateway URL | http://gateway:8080 |
LOG_LEVEL | Logging level | info |
AWS S3 Configuration
Required for KYC document storage:| Variable | Description | Example |
|---|---|---|
AWS_ACCESS_KEY_ID | AWS access key | AKIA... |
AWS_SECRET_ACCESS_KEY | AWS secret key | ... |
AWS_S3_BUCKET_NAME | S3 bucket for KYC docs | olive-kyc-documents |
AWS_REGION | AWS region | us-east-1 |
Example Configuration
Configuration by Environment
- Development
- Production
- Docker
OpenAI Configuration
Model Selection
The agent supports various OpenAI models:| Model | Use Case | Cost |
|---|---|---|
gpt-4o-mini | Default, fast responses | Low |
gpt-4o | Complex reasoning | Medium |
gpt-4-turbo | High accuracy | High |
Assistant Management
On first run, the agent creates an OpenAI Assistant with the configured tools. The assistant ID is logged and can be set inOPENAI_ASSISTANT_ID for subsequent runs to reuse the same assistant.
S3 Bucket Configuration
Bucket Policy
The S3 bucket should be private with appropriate IAM permissions:CORS Configuration
For pre-signed URL access:Rate Limiting
Default rate limits (configurable inrate-limiter.ts):
| Limit | Value |
|---|---|
| Requests per minute (per phone) | 30 |
| Concurrent conversations | 100 |
| Image uploads per hour | 10 |
Troubleshooting
Common Issues
OpenAI API errors
OpenAI API errors
- Verify
OPENAI_API_KEYis valid - Check API quota and billing
- Ensure network access to OpenAI endpoints
Gateway connection failures
Gateway connection failures
- Verify
GATEWAY_URLis reachable - Check
GATEWAY_API_KEYis valid - Ensure gateway service is running
S3 upload failures
S3 upload failures
- Verify AWS credentials are correct
- Check bucket exists and is accessible
- Ensure IAM permissions are configured
WhatsApp webhook not verified
WhatsApp webhook not verified
- Ensure
WHATSAPP_VERIFY_TOKENmatches Meta configuration - Check endpoint is publicly accessible (HTTPS)
- Verify URL in Meta Developer Console