-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaira_test_client.py
More file actions
60 lines (48 loc) · 1.68 KB
/
aira_test_client.py
File metadata and controls
60 lines (48 loc) · 1.68 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
import requests
AIRA_HUB = "https://aira-fl8f.onrender.com"
USERNAME = "admin"
PASSWORD = "password123"
def get_token():
print("🔐 Autenticando...")
resp = requests.post(
f"{AIRA_HUB}/token",
data={"username": USERNAME, "password": PASSWORD},
headers={"Content-Type": "application/x-www-form-urlencoded"}
)
if resp.status_code != 200:
print("❌ Falha ao autenticar:", resp.text)
return None
token = resp.json()["access_token"]
print("✅ Token recebido!")
return token
def list_agents(token):
print("🌐 Listando agentes registrados...")
headers = {"Authorization": f"Bearer {token}"}
resp = requests.get(f"{AIRA_HUB}/status", headers=headers)
if resp.status_code != 200:
print("❌ Erro ao listar agentes:", resp.text)
return []
data = resp.json()
for ag in data.get("agents", []):
print(f"🧠 {ag['name']} ({ag['status']}) - {ag['url']}")
return data.get("agents", [])
def find_dummy(agents):
for ag in agents:
if ag["name"] == "DummyTestAgent":
print("✅ DummyTestAgent encontrado!")
return ag
print("❌ DummyTestAgent não encontrado.")
return None
def main():
token = get_token()
if not token:
return
agents = list_agents(token)
dummy = find_dummy(agents)
if dummy:
print("🚀 Tudo pronto. Dummy está conectado e visível!")
# Aqui você pode adicionar chamadas como invoke_tool()
else:
print("😭 Nenhum agente dummy foi encontrado. Está rodando o dummy_agent_sse.py?")
if __name__ == "__main__":
main()