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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target/
*.class
*.jar
!src/
.mvn/
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,20 @@ public class Quickstart {
// Check connectivity / discover available capabilities
System.out.println(client.getCapabilities(RequestOptions.none()));

// Send an intent
// Send an intent to a registered agent address
Map<String, Object> intent = client.createIntent(
Map.of(
"intent_type", "order.fulfillment.v1",
"payload", Map.of("order_id", "ord_123", "priority", "high"),
"owner_agent", "agent://fulfillment-service"
"to_agent", "agent://acme-corp/production/fulfillment-service",
"payload", Map.of("order_id", "ord_123", "priority", "high")
),
new RequestOptions("fulfill-ord-123-001", null)
);
System.out.println(intent.get("intent_id") + " " + intent.get("status"));

// List registered agent addresses
Map<String, Object> agents = client.listAgents("acme-corp-uuid", "prod-ws-uuid", null, RequestOptions.none());
System.out.println(agents.get("agents"));
}
}
```
Expand Down
3 changes: 1 addition & 2 deletions examples/BasicSubmit.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public static void main(String[] args) throws Exception {
Map.of(
"intent_type", "intent.demo.v1",
"correlation_id", UUID.randomUUID().toString(),
"from_agent", "agent://basic/java/source",
"to_agent", "agent://basic/java/target",
"to_agent", "agent://acme-corp/production/target",
"payload", Map.of("task", "hello-from-java")
),
RequestOptions.none()
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/dev/axme/sdk/AxmeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ public Map<String, Object> revokeServiceAccountKey(String serviceAccountId, Stri
normalizeOptions(options));
}

public Map<String, Object> listAgents(String orgId, String workspaceId, Integer limit, RequestOptions options)
throws IOException, InterruptedException {
Map<String, String> query = new LinkedHashMap<>();
query.put("org_id", orgId);
query.put("workspace_id", workspaceId);
if (limit != null && limit > 0) {
query.put("limit", Integer.toString(limit));
}
return requestJson("GET", "/v1/agents", query, null, normalizeOptions(options));
}

public Map<String, Object> getAgent(String address, RequestOptions options)
throws IOException, InterruptedException {
String pathPart = address.trim().startsWith("agent://")
? address.trim().substring("agent://".length())
: address.trim();
return requestJson("GET", "/v1/agents/" + pathPart, Map.of(), null, normalizeOptions(options));
}

public Map<String, Object> createIntent(Map<String, Object> payload, RequestOptions options)
throws IOException, InterruptedException {
return requestJson("POST", "/v1/intents", Map.of(), payload, normalizeOptions(options));
Expand Down
Loading