← All lessons/Graph & Joins
25
Graph & Joins

Graph Edges

Create typed, directional edges between agents to model relationships.

Prerequisite: Lesson 4 complete

What you'll learn

  • ✓POST /v1/graph/edges — from_agent, to_agent, edge_type, meta
  • ✓GET /v1/graph/edges?from=users — outbound edges
  • ✓GET /v1/graph/edges?to=orders — inbound edges
  • ✓DELETE /v1/graph/edges/:from/:to/:type — remove edge
  • ✓Graph layer vs strand records — two separate stores
Challenge

Model: company → departments → employees → time_entries. Create the three edges. List to confirm.

What you'll learn

Create typed, directional edges between agents, and query connected agents.

What graph edges are for

Agents are nodes. Edges express relationships: - users → orders (a user has orders) - orders → payments (an order has payments) - users → sessions (a user has sessions)

These are structural links stored in the graph layer — separate from the strand records.

Create an edge

curl -s -X POST http://localhost:7475/v1/graph/edges \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer spx_root_YOUR_ROOT_KEY" \
  -d '{
    "from_agent": "users",
    "to_agent":   "orders",
    "edge_type":  "has_orders",
    "meta":       {"established": "2026-07-09"}
  }' | python3 -m json.tool

List edges from an agent

curl -s "http://localhost:7475/v1/graph/edges?from=users" \
  -H "Authorization: Bearer spx_root_YOUR_ROOT_KEY" \
  | python3 -m json.tool

List edges to an agent

curl -s "http://localhost:7475/v1/graph/edges?to=orders" \
  -H "Authorization: Bearer spx_root_YOUR_ROOT_KEY" \
  | python3 -m json.tool

Delete an edge

curl -s -X DELETE "http://localhost:7475/v1/graph/edges/users/orders/has_orders" \
  -H "Authorization: Bearer spx_root_YOUR_ROOT_KEY"

Authorization (added 2026-09-21)

POST/GET /v1/graph/edges and DELETE /v1/graph/edges/:src/:type/:dst require the root key or a scoped key holding admin:graph — creating or deleting an edge reveals or changes structural links between agents platform-wide, so it's treated as cluster-wide configuration, not a per-tenant operation.

Challenge

Model this graph: company → departments → employees → time_entries. Create the three edges. List them to confirm the structure.

---

← Previous
Lesson 24: Chain Verification
Next →
Lesson 26: Graph Traversal

The Sensart ecosystem

Explore our products

One team, many agents. Each product below is built by Sensart Technologies toward an agent-native future.

Boboyka VoiceBoboyka VoiceVoice generation engineHire BoboykaHire BoboykaHire 24/7 AI employeesBoboykaBoboykaAutonomous software factoryCodiosCodiosAgent caging platformA2AA2AAI agent governance platformConduitConduitVisual MCP orchestration studioPentestPentestAI penetration testingPromoterPromoterGrow your product organicallyMactebMactebGamified homeschooling
An umbrella ofSensart TechnologiesSensart Technologies