C3 AI Documentation Home

Dynamic Agent Overview

A Dynamic Agent enables a large language model (LLM) to handle compound queries that require multiple data sources, computations, or custom tools. The agent breaks down the query into intermediate steps, executes each step using available tools, and combines the results to generate a response.

You use the Dynamic Agent to extend the platform's reasoning capabilities by configuring system prompts, callbacks with few-shot examples, and toolkits that guide the LLM's execution process.

A system prompt sets the goals, rules, and intended behavior and reasoning of the agent. Callbacks and few-shot examples work together: callbacks allow you to run custom logic at different execution stages (such as retrieving few-shot examples and injecting them into the system prompt), enabling you to dynamically modify the agent's internal state and guide its reasoning.

Dynamic Agent components

You can build a Dynamic Agent using the Genai.Agent.Dynamic.Persistable Type and configure it through Genai.Agent.Dynamic.Config. Agents support multi-step reasoning and can run multiple tools in sequence to answer complex questions.

Each Dynamic Agent uses a toolkit defined by Genai.Agent.Dynamic.Toolkit that includes tools available during execution.

You must implement tools as Python functions and register tools in the agent's toolkit.

When a user sends a query, the Dynamic Agent:

  1. Breaks the query into smaller steps.
  2. Chooses tools from its toolkit to complete each step.
  3. Combines the results to form a response.

The agent can automatically process the tool output and display the results as text, tables, charts, or images based on the output type.

Custom tools for Dynamic Agent

Add custom tools to support new data sources, APIs, or business logic. To do this:

  1. Create a Python function in a .py file.
  2. Register the tool as a Genai.Agent.Dynamic.Tool.
  3. Add the tool to a Genai.Agent.Dynamic.Toolkit.

You can also pass configuration parameters to tools using Genai.Agent.Dynamic.Tool#toolConfigurationParams.

For guidance, see Create Custom Tools.

Dynamic Agent configuration

Configure a Dynamic Agent by defining its system prompt, step callbacks, and few-shot examples. These control how the agent interprets queries, executes steps, and generalizes behavior.

Configure system prompts

System prompts define the agent’s behavior before it receives a query. They establish goals, provide context, set formatting rules, and outline constraints. A well-designed system prompt helps the agent plan how to solve the query and choose the right tools.

For example, a system prompt may define:

  • The type of language or tone the agent should use.
  • What the agent should prioritize in its responses.
  • Which tools or steps to avoid in specific scenarios.

For guidance on authoring system prompts and structuring the prompt content, see Dynamic agent system prompts.

Configure callbacks and few-shot examples

Step callbacks let you run custom logic at different points while the agent processes a query. You can use them to:

  • Modify the input or output of a step.
  • Influence tool selection.
  • Control the agent’s internal state at different points in the reasoning process.

Step callbacks allow fine-tuning based on domain-specific logic or real-time inputs. Few-shot examples are query-response pairs that show the agent how to complete specific tasks. Together, callbacks and few-shots enable you to customize agent behavior: use the few_shot_setup callback to automatically retrieve and inject relevant examples into the system prompt.

Use this combined approach to demonstrate task-specific formats, modify query input or output, influence tool selection, inject dynamic context into the system prompt, and control the agent's internal state at different reasoning points. Well-chosen examples improve performance, especially for complex or task-specific queries.

Learn more in Dynamic Agent Few Shots and Callbacks

Preconfigured Dynamic Agents

The C3 Generative AI Application includes two preconfigured Dynamic Agents that extend Genai.Agent.Dynamic.Persistable with specialized capabilities. All are available in the Agent Gallery and can be customized or duplicated in the Agent Workbench to create variants with different tools, prompts, or execution parameters.

Canvas Agent

Provides a rich text editing interface for creating, updating, and managing documents directly in the UI. The agent supports multimodal outputs including forms, visualizations, and structured data.

Learn more in Canvas Agent.

Deep Research Agent

Specializes in research-intensive workflows that require multi-step reasoning and document generation. Built on the Canvas Agent framework, it coordinates multiple internal roles such as research lead, researchers, writers, and critics to generate comprehensive reports.

  • Type: Genai.Agent.Dynamic.Canvas
  • Configuration key: CanvasAgent_deep_research
  • Default LLM: Claude 4 Sonnet
  • Deployment: Requires deployment via Genai.QuickStart.deployCoreAgents(["dynamic_canvas_deep_research"])

Learn more in Deep Research Agent.

See also

Was this page helpful?