From dd440390a688f0566c8a2cb99263deb08bdd02e0 Mon Sep 17 00:00:00 2001 From: geobelsky Date: Wed, 11 Mar 2026 18:58:40 +0000 Subject: [PATCH] feat(sdk): add ListIntentEvents method and update README Made-with: Cursor --- README.md | 15 +++++++++++---- axme/client.go | 30 ++++++++++++++++++++++++++++++ examples/basic_submit.go | 3 +-- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bb17345..e33143b 100644 --- a/README.md +++ b/README.md @@ -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"]) } ``` diff --git a/axme/client.go b/axme/client.go index 463ae52..e3af396 100644 --- a/axme/client.go +++ b/axme/client.go @@ -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, diff --git a/examples/basic_submit.go b/examples/basic_submit.go index 9c3fa7b..cce8bce 100644 --- a/examples/basic_submit.go +++ b/examples/basic_submit.go @@ -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 {