Skip to content

Add Agent Route to an Agent

client.Agents.Routes.Add(ctx, parentAgentUuid, childAgentUuid, body) (*AgentRouteAddResponse, error)
post/v2/gen-ai/agents/{parent_agent_uuid}/child_agents/{child_agent_uuid}

To add an agent route to an agent, send a POST request to /v2/gen-ai/agents/{parent_agent_uuid}/child_agents/{child_agent_uuid}.

ParametersExpand Collapse
parentAgentUuid string
childAgentUuid string
body AgentRouteAddParams
ChildAgentUuid param.Field[string]optional

Routed agent id

IfCase param.Field[string]optional
ParentAgentUuid param.Field[string]optional

A unique identifier for the parent agent.

RouteName param.Field[string]optional

Name of route

ReturnsExpand Collapse
type AgentRouteAddResponse struct{…}

Information about a newly linked agent

ChildAgentUuid stringoptional

Routed agent id

ParentAgentUuid stringoptional

A unique identifier for the parent agent.

Add Agent Route to an Agent
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.Agents.Routes.Add(
    context.TODO(),
    `"123e4567-e89b-12d3-a456-426614174000"`,
    `"123e4567-e89b-12d3-a456-426614174000"`,
    gradient.AgentRouteAddParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.ChildAgentUuid)
}
{
  "child_agent_uuid": "123e4567-e89b-12d3-a456-426614174000",
  "parent_agent_uuid": "123e4567-e89b-12d3-a456-426614174000"
}
Returns Examples
{
  "child_agent_uuid": "123e4567-e89b-12d3-a456-426614174000",
  "parent_agent_uuid": "123e4567-e89b-12d3-a456-426614174000"
}