Skip to main content

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​

  1. Open the create dialog

    Go to Context Graph → Graph. Click the + button (Add entity), and select Team.

  2. Fill in the team

    In Title, type Shop Backend. Check that Name (auto-generated) shows shop-backend. In Description, type Owns the backend services of the Astronomy Shop.

  3. Create the team

    Click Create.

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.

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.

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​

  1. Open the service

    On Graph, select Recommendation. In the details panel, click Edit.

  2. Add the relationship

    Under Relationships, find Add a relationship. Select Dependencies in the first list and Product Catalog in the second list. Click Add.

  3. Save

    Click Save changes.

Do the same for Frontend. Add two Dependencies: Recommendation and 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:

BASH
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:

sourcerelationKeytarget
frontenddepends_onrecommendation
recommendationdepends_onproduct-catalog
recommendationownershop-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 autoheal lists entities that people and agents made in Autoheal.
  • owner takes one target. In the web app, a new owner replaces the old one. The CLI refuses a second owner with code 14111. Take the old owner off first with relations 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​

BASH
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.