Skip to content
Merged
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
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,23 @@ func main() {
}
fmt.Println(capabilities)

// Send an intent
// Send an intent to a registered agent address
intent, err := client.CreateIntent(ctx, map[string]any{
"intent_type": "order.fulfillment.v1",
"payload": map[string]any{"order_id": "ord_123", "priority": "high"},
"owner_agent": "agent://fulfillment-service",
"intent_type": "order.fulfillment.v1",
"to_agent": "agent://acme-corp/production/fulfillment-service",
"payload": map[string]any{"order_id": "ord_123", "priority": "high"},
}, axme.RequestOptions{IdempotencyKey: "fulfill-ord-123-001"})
if err != nil {
log.Fatal(err)
}
fmt.Println(intent["intent_id"], intent["status"])

// List registered agent addresses
agents, err := client.ListAgents(ctx, "acme-corp-uuid", "prod-ws-uuid", nil, axme.RequestOptions{})
if err != nil {
log.Fatal(err)
}
fmt.Println(agents["agents"])
}
```

Expand Down
30 changes: 30 additions & 0 deletions axme/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,36 @@ func (c *Client) RevokeServiceAccountKey(
)
}

func (c *Client) ListAgents(
ctx context.Context,
orgID string,
workspaceID string,
limit *int,
options RequestOptions,
) (map[string]any, error) {
query := map[string]string{"org_id": orgID, "workspace_id": workspaceID}
if limit != nil && *limit > 0 {
query["limit"] = strconv.Itoa(*limit)
}
return c.requestJSON(ctx, http.MethodGet, "/v1/agents", query, nil, options)
}

func (c *Client) GetAgent(
ctx context.Context,
address string,
options RequestOptions,
) (map[string]any, error) {
pathPart := strings.TrimPrefix(strings.TrimSpace(address), "agent://")
return c.requestJSON(
ctx,
http.MethodGet,
fmt.Sprintf("/v1/agents/%s", pathPart),
nil,
nil,
options,
)
}

func (c *Client) CreateIntent(
ctx context.Context,
payload map[string]any,
Expand Down
3 changes: 1 addition & 2 deletions examples/basic_submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ func main() {
created, err := client.CreateIntent(context.Background(), map[string]any{
"intent_type": "intent.demo.v1",
"correlation_id": correlationID,
"from_agent": "agent://basic/go/source",
"to_agent": "agent://basic/go/target",
"to_agent": "agent://acme-corp/production/target",
"payload": map[string]any{"task": "hello-from-go"},
}, axme.RequestOptions{})
if err != nil {
Expand Down
Loading