Skip to main content

Configuration File

Create a .runflow/rf.json file:
{
  "agentId": "your_agent_id",
  "tenantId": "your_tenant_id",
  "apiKey": "your_api_key",
  "apiUrl": "http://localhost:3001"
}
The SDK automatically searches for .runflow/rf.json in the current directory and parent directories.
When you run rf create or rf agents clone, the .runflow/rf.json file is created automatically with the correct values.

Using config outside the SDK

By default, the SDK reads rf.json internally when creating agents and API clients. But if you need the config available to external tools (Promptfoo, custom test scripts, CI pipelines, or any Node.js process), add a single import:
import '@runflow-ai/sdk/init';
This reads .runflow/rf.json and sets the following environment variables in process.env:
rf.json fieldEnvironment variable
apiUrlRUNFLOW_API_URL
apiKeyRUNFLOW_API_KEY
tenantIdRUNFLOW_TENANT_ID
agentIdRUNFLOW_AGENT_ID
Existing environment variables are never overwritten — explicit env vars always take priority over rf.json values.

Examples

Promptfoo config:
promptfooconfig.ts
import '@runflow-ai/sdk/init';

// process.env.RUNFLOW_API_URL is now available
export default {
  providers: [{
    id: 'runflow',
    config: { apiUrl: process.env.RUNFLOW_API_URL },
  }],
};
Custom test script:
test.ts
import '@runflow-ai/sdk/init';
import { main } from './main';

// Your agent can resolve its config automatically
const result = await main({ message: 'Hello' });
console.log(result);
Any standalone script:
scripts/check-agent.ts
import '@runflow-ai/sdk/init';

console.log('Agent ID:', process.env.RUNFLOW_AGENT_ID);
console.log('API URL:', process.env.RUNFLOW_API_URL);
init is idempotent — safe to import multiple times from different files. It reads rf.json once and skips subsequent calls.

Configuration Priority

  1. Explicit config in code
  2. .runflow/rf.json
  3. Environment variables
  4. Defaults

Next Steps

Environment Variables

Learn about environment variables

API Client

Manual API client setup