-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_agent.py
More file actions
76 lines (55 loc) · 1.99 KB
/
Copy pathcreate_agent.py
File metadata and controls
76 lines (55 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""
AutoManus API - Create Agent Example (Python)
Creates an AI sales agent and deploys it to WhatsApp + Webchat.
Usage:
python create_agent.py
Environment variables:
AUTOMANUS_API_KEY - Optional. If provided, agent is created under your account.
"""
import os
import requests
API_URL = 'https://automanus.io/api/v1/public/agents'
def create_agent():
# Your details
email = 'you@company.com'
company_name = 'Acme Corp'
website_url = 'https://acme.com'
# Optional: Use API key for authenticated requests
api_key = os.environ.get('AUTOMANUS_API_KEY')
headers = {
'Content-Type': 'application/json',
}
if api_key:
headers['Authorization'] = f'Bearer {api_key}'
payload = {
'email': email,
'company_name': company_name,
'website_url': website_url,
}
try:
response = requests.post(API_URL, json=payload, headers=headers)
data = response.json()
if not response.ok:
print(f"Error: {data.get('error', 'Failed to create agent')}")
return
print('Agent created successfully!\n')
print(f"Agent ID: {data['agent_id']}")
print(f"Agent Name: {data['agent_name']}")
print(f"Company: {data['company_name']}")
print('\n--- Deployment Info ---')
print(f"WhatsApp Link: {data['whatsapp_link']}")
print(f"Knowledge Base Items: {data['knowledge_base_count']}")
if data.get('webchat_embed_code'):
print('\n--- Webchat Embed Code ---')
print(data['webchat_embed_code'])
if data.get('claim_url'):
print('\n--- Claim Your Agent ---')
print('Check your email for the magic link, or visit:')
print(data['claim_url'])
if data.get('dashboard_url'):
print('\n--- Dashboard ---')
print(data['dashboard_url'])
except requests.RequestException as e:
print(f"Request failed: {e}")
if __name__ == '__main__':
create_agent()