Code Examples

Code examples in multiple languages.

Quick Examples

Python

import requests

api_key = "your_api_key"
headers = {"Authorization": f"Bearer {api_key}"}

# Create an agent
response = requests.post(
    "https://api.agenticflow.com/v1/agents",
    headers=headers,
    json={
        "name": "Support Assistant",
        "system_prompt": "You are a helpful support agent."
    }
)

agent = response.json()
print(f"Created agent: {agent['id']}")

JavaScript

const apiKey = 'your_api_key';

// Create an agent
const response = await fetch('https://api.agenticflow.com/v1/agents', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Support Assistant',
    system_prompt: 'You are a helpful support agent.'
  })
});

const agent = await response.json();
console.log(`Created agent: ${agent.id}`);

cURL

curl -X POST https://api.agenticflow.com/v1/agents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Assistant",
    "system_prompt": "You are a helpful support agent."
  }'

More Examples

← Back to API Documentation

Last updated

Was this helpful?