| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
For setup, authentication, backends, and background on ManagedAgent, see the ManagedAgent guide.
This sample runs a ManagedAgent configured with the built-in code execution tool so it can write and run code server-side to compute answers.
Unlike a regular LlmAgent (which enables code execution via code_executor=BuiltInCodeExecutor()), ManagedAgent has no code_executor field. Instead you pass the raw built-in tool config types.Tool(code_execution=types.ToolCodeExecution()) in tools -- the same config BuiltInCodeExecutor produces under the hood. This makes the sample a demonstration of the raw types.Tool server-side tool path.
What is the sum of the first 50 prime numbers? Use code to compute it.
The model writes and runs code server-side; the answer (5117) comes from the executed code rather than the model guessing.
Now do the same for the first 100 primes.
A follow-up turn that reuses the recovered remote sandbox and the previous interaction (answer: 24133), demonstrating multi-turn chaining.
graph LR
User -->|message| ManagedAgent
ManagedAgent -->|interactions.create| ManagedAgentsAPI
ManagedAgentsAPI -->|server-side code execution| ManagedAgentsAPI
ManagedAgentsAPI -->|streamed events| ManagedAgent
ManagedAgent -->|answer| User
| Back | FazBrowse Home | New Git URL |