Skip to content

Commit 52c3e9e

Browse files
haranrkcopybara-github
authored andcommitted
docs: document creating and using a custom managed agent
Add a "Create and use a custom managed agent" section to the ManagedAgent guide showing the control-plane create/delete pattern via `ManagedAgent.api_client`, and complete the guide's Related samples list. Co-authored-by: Haran Rajkumar <haranrk@google.com> PiperOrigin-RevId: 954766292
1 parent b956d15 commit 52c3e9e

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

  • docs/guides/agents/managed_agent

docs/guides/agents/managed_agent/index.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,37 @@ root_agent = LlmAgent(
9797
)
9898
```
9999

100+
## Create and use a custom managed agent
101+
102+
`ManagedAgent` connects to an existing managed agent by `agent_id`. You can
103+
shape that agent's behavior inline, with no resource creation: set
104+
[`instruction`](#system-instruction) for a persona and pass server-side `tools`
105+
such as `google_search` (see [Get started](#get-started)).
106+
107+
Create a **custom managed-agent resource** when you instead want a persistent,
108+
named agent whose persona and server-side tools are baked into the resource and
109+
reusable by id across apps and sessions. Create it through the control plane,
110+
then point `ManagedAgent` at its id. The genai client `ManagedAgent` already
111+
holds (`managed_search_agent.api_client`) exposes both planes: interactions
112+
(data plane) and `agents.create` / `agents.delete` (control plane), so you can
113+
create with the same client:
114+
115+
```python
116+
created = managed_search_agent.api_client.agents.create(
117+
id='adk-custom-search-agent',
118+
base_agent='antigravity-preview-05-2026',
119+
system_instruction='You are a concise research assistant. ...',
120+
tools=[{'type': 'google_search'}],
121+
)
122+
# created.id is the agent id ManagedAgent(agent_id=...) connects to.
123+
```
124+
125+
Creating a custom agent requires the GEAP/Vertex backend (`global` location);
126+
its `system_instruction` and tools are fixed at create time, and creation is
127+
asynchronous (the agent takes a short while to become ready). See the
128+
[custom_agent sample](../../../../contributing/samples/managed_agent/custom_agent)
129+
for a runnable example with `--create` / `--delete` flags.
130+
100131
## How it works
101132

102133
The `ManagedAgent` implements the `BaseAgent` contract but bypasses standard
@@ -177,3 +208,6 @@ root_agent = ManagedAgent(
177208
* [Managed Agent Basic](../../../../contributing/samples/managed_agent/basic)
178209
* [Managed Agent Code Execution](../../../../contributing/samples/managed_agent/code_execution)
179210
* [Managed Agent System Instruction](../../../../contributing/samples/managed_agent/system_instruction)
211+
* [Managed Agent Remote MCP](../../../../contributing/samples/managed_agent/remote_mcp)
212+
* [Managed Agent Single-Turn Orchestration](../../../../contributing/samples/managed_agent/single_turn)
213+
* [Managed Agent Create and Use a Custom Agent](../../../../contributing/samples/managed_agent/custom_agent)

0 commit comments

Comments
 (0)