Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,25 @@ client = AxmeClient(
# Check connectivity
print(client.health())

# Send an intent
# Send an intent to a registered agent address
intent = client.create_intent(
{
"intent_type": "order.fulfillment.v1",
"to_agent": "agent://acme-corp/production/fulfillment-service",
"payload": {"order_id": "ord_123", "priority": "high"},
"owner_agent": "agent://fulfillment-service",
},
idempotency_key="fulfill-ord-123-001",
correlation_id="corr-ord-123-001",
)
print(intent["intent_id"], intent["status"])

# List registered agent addresses in your workspace
agents = client.list_agents(org_id="acme-corp-uuid", workspace_id="prod-ws-uuid")
for agent in agents["agents"]:
print(agent["address"], agent["status"])

# Wait for resolution
resolved = client.wait_for(intent["intent_id"], terminal_states={"RESOLVED", "CANCELLED"})
resolved = client.wait_for(intent["intent_id"])
print(resolved["status"])
```

Expand Down
38 changes: 38 additions & 0 deletions axme_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,44 @@ def create_service_account_key(
retryable=idempotency_key is not None,
)

def list_agents(
self,
*,
org_id: str,
workspace_id: str,
limit: int | None = None,
trace_id: str | None = None,
) -> dict[str, Any]:
"""List registered agent addresses in a workspace.

Returns a dict with an ``agents`` list, each entry containing
``address``, ``display_name``, ``status``, and ``created_at``.
"""
params: dict[str, str] = {"org_id": org_id, "workspace_id": workspace_id}
if limit is not None:
params["limit"] = str(limit)
return self._request_json(
"GET",
"/v1/agents",
params=params,
trace_id=trace_id,
retryable=True,
)

def get_agent(self, address: str, *, trace_id: str | None = None) -> dict[str, Any]:
"""Get agent address details by full ``agent://org/workspace/name`` address."""
if not isinstance(address, str) or not address.strip():
raise ValueError("address must be a non-empty string")
path_part = address.strip()
if path_part.startswith("agent://"):
path_part = path_part[len("agent://"):]
return self._request_json(
"GET",
f"/v1/agents/{path_part}",
trace_id=trace_id,
retryable=True,
)

def revoke_service_account_key(
self,
service_account_id: str,
Expand Down
3 changes: 1 addition & 2 deletions examples/basic_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ def main() -> None:
created = client.create_intent(
{
"intent_type": "intent.demo.v1",
"from_agent": "agent://basic/python/source",
"to_agent": "agent://basic/python/target",
"to_agent": "agent://acme-corp/production/target",
"payload": {"task": "hello-from-python"},
},
correlation_id=correlation_id,
Expand Down
Loading