API Configuration
Learn how to configure the Donobu API, set up GPT configurations, and manage environment variables.
GPT Configuration
Before creating AI-powered flows, you need to configure at least one GPT provider. The Donobu API supports multiple AI providers:
Supported Providers
- OpenAI: GPT-4, GPT-3.5 and other OpenAI models
- Anthropic: Claude models via direct API
- Anthropic via AWS Bedrock: Claude models through AWS
- Google Gemini: Google's Generative AI models
- Google Vertex AI: Enterprise Google AI platform
Creating a GPT Configuration
# OpenAI Configuration curl -X POST http://localhost:31000/api/gpt-configs/openai-gpt4 \ -H "Content-Type: application/json" \ -d '{ "type": "OPENAI", "apiKey": "your-openai-api-key", "modelName": "gpt-4" }' # Anthropic Configuration curl -X POST http://localhost:31000/api/gpt-configs/claude-sonnet \ -H "Content-Type: application/json" \ -d '{ "type": "ANTHROPIC", "apiKey": "your-anthropic-api-key", "modelName": "claude-3-sonnet-20240229" }'
Listing GPT Configurations
curl -X GET http://localhost:31000/api/gpt-configs
Environment Variables
Environment variables can be used within your flows to store configuration values, API keys, or other data that should not be hardcoded.
Setting Environment Variables
# Set a database URL curl -X POST http://localhost:31000/api/env/DATABASE_URL \ -H "Content-Type: application/json" \ -d '{ "value": "postgresql://user:password@localhost:5432/mydb" }' # Set a test user email curl -X POST http://localhost:31000/api/env/TEST_USER_EMAIL \ -H "Content-Type: application/json" \ -d '{ "value": "test@example.com" }'
Using Environment Variables in Flows
When creating a flow, specify which environment variables should be available:
curl -X POST http://localhost:31000/api/flows \ -H "Content-Type: application/json" \ -d '{ "name": "Login Test Flow", "targetWebsite": "https://app.example.com/login", "overallObjective": "Log in using the test credentials", "envVars": ["TEST_USER_EMAIL", "TEST_USER_PASSWORD"], "initialRunMode": "AUTONOMOUS" }'
Agent Configuration
Agents are responsible for making decisions during autonomous flows. You can assign specific GPT configurations to different agents.
Assigning GPT Configuration to Agent
# Assign the OpenAI configuration to the flow-runner agent curl -X POST http://localhost:31000/api/agents/flow-runner \ -H "Content-Type: application/json" \ -d '{ "gptConfigName": "openai-gpt4" }'
Checking Agent Configuration
curl -X GET http://localhost:31000/api/agents/flow-runner
Browser Configuration
Configure different browser settings for your flows:
Device Browser (Local)
{ "browser": { "using": { "type": "device", "deviceName": "Desktop Chromium", "headless": false, "proxy": { "server": "http://proxy.example.com:8080" } } } }
Remote Browser Instance
{ "browser": { "using": { "type": "remoteInstance", "url": "ws://remote-browser:9222" } } }
BrowserBase Cloud
{ "browser": { "using": { "type": "browserBase", "sessionArgs": { "projectId": "your-browserbase-project-id", "browserSettings": { "viewport": { "width": 1920, "height": 1080 }, "blockAds": true, "solveCaptchas": true }, "timeout": 300, "region": "us-east-1" } } } }
API Authentication
The Donobu API runs locally and does not require authentication when accessed from localhost. However, ensure that:
- Only trusted applications have access to your local machine
- Environment variables containing sensitive data are properly managed
- GPT API keys are stored securely
Error Handling
The API returns standardized error responses:
{ "code": "FLOW_NOT_FOUND", "message": "A flow with the specified ID was not found." }
Common error codes:
FLOW_NOT_FOUND
: The specified flow ID does not existINVALID_REQUEST
: Request body or parameters are malformedGPT_CONFIG_NOT_FOUND
: The specified GPT configuration does not existFLOW_STILL_RUNNING
: Cannot delete or modify a running flow