2. Add Your Services
In this page, you add a small part of the Astronomy Shop to the Context Graph. You add one team and three services:
The example pull request changes src/recommendation. With this graph, an agent can find that the shop-backend team owns recommendation, that recommendation calls product-catalog, and that frontend calls recommendation.
Use the web app or the CLI. Both write to the same graph.
Step 1: Add the owner team
- Web app
- CLI
- Open the create dialog
Go to Context Graph → Graph. Click the + button (Add entity), and select Team.
- Fill in the team
In Title, type
Shop Backend. Check that Name (auto-generated) showsshop-backend. In Description, typeOwns the backend services of the Astronomy Shop. - Create the team
Click Create.
autoheal context-graph blueprints entities create team \
-f name=shop-backend -f title="Shop Backend" \
-f 'properties={"description":"Owns the backend services of the Astronomy Shop."}'
The name is the identity of the entity. Labels, relations and tools use the name, not the title. A name has lowercase letters, digits, - and _, and starts with a letter.
Step 2: Add the services
Add three services: Product Catalog, Recommendation and Frontend. Give each one the owner team shop-backend.
- Web app
- CLI
For each service, click + (Add entity) and select Service. Type the title, for example Product Catalog. In Owner Team, select Shop Backend. Fill in Description, Primary Language and Service Tier if you want to. Click Create.
autoheal context-graph blueprints entities create service \
-f name=product-catalog -f title="Product Catalog" \
-f 'properties={"description":"Lists the products of the Astronomy Shop.","language":"Go","tier":"tier-1"}' \
-f 'relations={"owner":"shop-backend"}'
autoheal context-graph blueprints entities create service \
-f name=recommendation -f title="Recommendation" \
-f 'properties={"description":"Suggests products that go with the products in the cart.","language":"Python","tier":"tier-2"}' \
-f 'relations={"owner":"shop-backend"}'
autoheal context-graph blueprints entities create service \
-f name=frontend -f title="Frontend" \
-f 'properties={"description":"The web store that customers use.","language":"TypeScript","tier":"tier-1"}' \
-f 'relations={"owner":"shop-backend"}'
Add the team before the services. A relation to an entity that does not exist fails with code 14108, "Target entity not found".
Step 3: Add the dependencies
- Web app
- CLI
- Open the service
On Graph, select Recommendation. In the details panel, click Edit.
- Add the relationship
Under Relationships, find Add a relationship. Select Dependencies in the first list and Product Catalog in the second list. Click Add.
- Save
Click Save changes.
Do the same for Frontend. Add two Dependencies: Recommendation and Product Catalog.
autoheal context-graph blueprints relations add service recommendation depends_on -f target=product-catalog
autoheal context-graph blueprints relations add service frontend depends_on -f target=recommendation
autoheal context-graph blueprints relations add service frontend depends_on -f target=product-catalog
Step 4: Check the graph
On Graph, select Recommendation. Check that the details panel shows Shop Backend, Product Catalog and Frontend under Relationships. Click Focus connections to show only its neighbors.
From the CLI, read the entity and its neighborhood:
autoheal context-graph blueprints entities get service recommendation
autoheal context-graph neighborhood --root-kind catalog_entity --root-id <id> --depth 1
Use the id from the first command in the second command. Check that the entity has "relations":{"depends_on":["product-catalog"],"owner":["shop-backend"]}. Check that the neighborhood has three catalog_relation edges:
source | relationKey | target |
|---|---|---|
| frontend | depends_on | recommendation |
| recommendation | depends_on | product-catalog |
| recommendation | owner | shop-backend |
The edges show node keys, not names. Find the names in the nodes list.
Sources fill the graph for you
You added these entities by hand. In a real project, integrations add most entities. GitHub, GitLab, Bitbucket and Azure DevOps add repositories. PagerDuty, ServiceNow, Datadog and Jira add services, teams and people. Slack adds people and channels. Go to Context Graph → Sources to see which Integration Connections add entities, and how many. See Sync integrations.
What to know
- An entity that you add by hand has no integration source.
autoheal context-graph blueprints entities list service --source autoheallists entities that people and agents made in Autoheal. ownertakes one target. In the web app, a new owner replaces the old one. The CLI refuses a second owner with code14111. Take the old owner off first withrelations remove.- To take one dependency off a service, run
autoheal context-graph blueprints relations remove service frontend depends_on product-catalog --yes. - To delete an entity, click Delete on its page, or run
autoheal context-graph blueprints entities delete <blueprint> <name> --yes. If other entities point at it, add--force. - Agents read your changes at once. You do not need to commit anything. Entities are not files in the project repository, so branches do not apply to them.
From the CLI
autoheal context-graph blueprints entities create service -f name=<name> -f title="<title>" -f 'relations={"owner":"<team>"}'
autoheal context-graph blueprints relations add service <name> depends_on -f target=<other service>
autoheal context-graph blueprints relations list service <name> depends_on
See Relationships and Explore and edit entities.