Build a custom sub-agent with instructions

Create a managed HR agent with a narrow policy sub-agent, test delegation in the playground and see the cost land on the parent.

After reading this page you will be able to:
  • Create a managed agent with instructions
  • Add a sub-agent with its own description and model override
  • See delegation in the trace and in usage
Intermediate30 minAgentsDocker

Prerequisites

  • A running Liyagent instance with one LLM provider configured.

Steps

  1. Open All agents → + Create agent and choose Managed by Liyagent. Name it HR helper. The agent ID shown under the name becomes hr-helper. Under Tags, enter team=hr.
  2. Pick a provider and model under Model, then write the Instructions:
    You help employees of {tenant} with HR questions. Today is {date}.
    - Answer briefly and point to the policy section you used.
    - For anything about leave balances or pay, delegate to the policy specialist.
    - Never discuss another employee.
  3. Choose Create agent, then Start on the agent's page.
  4. On the agent's Settings tab, under Subagents, choose Add subagent and name it leave-policy:
    FieldValue
    DescriptionAnswers questions about annual leave, sick leave and parental leave rules. Use for any question about days off.
    InstructionsAnswer only from the leave policy. Quote the rule. If unsure, say so.
    Model overrideA smaller, cheaper model
  5. Save. Open the Playground tab and ask: How many days of parental leave can I take?
  6. Choose Trace on the answer: you'll see the parent's call, a delegate to leave-policy, and the child's call on the cheaper model.
  7. Open the agent's Cost & Usage tab: the child's calls are recorded with the delegation chain that names hr-helper as the parent.
Note

Sub-agents cannot delegate further, and a delegation past the parent's Delegation depth is refused.

Next steps