Getting Started
Your First Request
Create a task and follow it to a result.
Tasks run in short, bounded steps. Each GET on a running task advances it by one step (up to about 45 seconds), then returns its current state. Keep polling until done is true.
import os, time, requests
H = {"Authorization": f"Bearer {os.environ['TAKEN_API_KEY']}"}
task = requests.post("https://taken.trade/api/public/v1/agent/tasks", headers=H,
json={"instruction": "Open example.com and tell me the page title"}, timeout=60).json()["data"]
while True:
t = requests.get(f"https://taken.trade/api/public/v1/agent/tasks/{task['id']}", headers=H, timeout=90).json()["data"]
print(t["status"], "-", t["events"][-1]["message"] if t["events"] else "")
if t["done"]:
print("Result:", t["result"]); break
time.sleep(1)Your browser time and daily AI requests are used exactly as if you ran the task in the app.