Skip to content

Commit ba91f77

Browse files
authored
feat(sdk): add listIntentEvents method, .gitignore for build artifacts, update README (#17)
Made-with: Cursor
1 parent 6146b3d commit ba91f77

4 files changed

Lines changed: 32 additions & 5 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target/
2+
*.class
3+
*.jar
4+
!src/
5+
.mvn/

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,20 @@ public class Quickstart {
100100
// Check connectivity / discover available capabilities
101101
System.out.println(client.getCapabilities(RequestOptions.none()));
102102

103-
// Send an intent
103+
// Send an intent to a registered agent address
104104
Map<String, Object> intent = client.createIntent(
105105
Map.of(
106106
"intent_type", "order.fulfillment.v1",
107-
"payload", Map.of("order_id", "ord_123", "priority", "high"),
108-
"owner_agent", "agent://fulfillment-service"
107+
"to_agent", "agent://acme-corp/production/fulfillment-service",
108+
"payload", Map.of("order_id", "ord_123", "priority", "high")
109109
),
110110
new RequestOptions("fulfill-ord-123-001", null)
111111
);
112112
System.out.println(intent.get("intent_id") + " " + intent.get("status"));
113+
114+
// List registered agent addresses
115+
Map<String, Object> agents = client.listAgents("acme-corp-uuid", "prod-ws-uuid", null, RequestOptions.none());
116+
System.out.println(agents.get("agents"));
113117
}
114118
}
115119
```

examples/BasicSubmit.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public static void main(String[] args) throws Exception {
1818
Map.of(
1919
"intent_type", "intent.demo.v1",
2020
"correlation_id", UUID.randomUUID().toString(),
21-
"from_agent", "agent://basic/java/source",
22-
"to_agent", "agent://basic/java/target",
21+
"to_agent", "agent://acme-corp/production/target",
2322
"payload", Map.of("task", "hello-from-java")
2423
),
2524
RequestOptions.none()

src/main/java/dev/axme/sdk/AxmeClient.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,25 @@ public Map<String, Object> revokeServiceAccountKey(String serviceAccountId, Stri
9898
normalizeOptions(options));
9999
}
100100

101+
public Map<String, Object> listAgents(String orgId, String workspaceId, Integer limit, RequestOptions options)
102+
throws IOException, InterruptedException {
103+
Map<String, String> query = new LinkedHashMap<>();
104+
query.put("org_id", orgId);
105+
query.put("workspace_id", workspaceId);
106+
if (limit != null && limit > 0) {
107+
query.put("limit", Integer.toString(limit));
108+
}
109+
return requestJson("GET", "/v1/agents", query, null, normalizeOptions(options));
110+
}
111+
112+
public Map<String, Object> getAgent(String address, RequestOptions options)
113+
throws IOException, InterruptedException {
114+
String pathPart = address.trim().startsWith("agent://")
115+
? address.trim().substring("agent://".length())
116+
: address.trim();
117+
return requestJson("GET", "/v1/agents/" + pathPart, Map.of(), null, normalizeOptions(options));
118+
}
119+
101120
public Map<String, Object> createIntent(Map<String, Object> payload, RequestOptions options)
102121
throws IOException, InterruptedException {
103122
return requestJson("POST", "/v1/intents", Map.of(), payload, normalizeOptions(options));

0 commit comments

Comments
 (0)