Create a Model Agnostic Agent with GPT-4o
This step-by-step guide walks you through creating a model agnostic agent that uses GPT-4o, with the Code tool for running Python and the Knowledge tool for searching files that users upload.
Overview
A model agnostic agent uses the generic agent workflow with the FoundationaLLMFunctionCallingWorkflow class from the foundationallm_agent_plugins package. The workflow lets the main model decide which tools to call, so the same agent design works with GPT models, Claude, and other completion models.
The agent you build here has:
- Code: writes and runs Python code in an isolated code session.
- Knowledge: answers questions from files uploaded to the conversation.
- Tool routing: the main model selects tools based on the user's question.
Prerequisites
- A GPT-4o completion AI model. See AI Models.
- The
GenericAgentWorkflowworkflow and thefoundationallm_agent_pluginsPython plugin package installed in your instance. - The FoundationaLLM platform prompts and platform tools installed (they provide the
Platform-Agent-*prompts and the Code and Knowledge tools in the Tool Library). - A code session provider for the Code tool. The tool's default provider is
AzureContainerAppsCustomContainer. - The Agents Contributor role on the instance.
Part 1: Create the Agent and Select the Workflow
- In the sidebar, select Agents > Agents, then select Create Agent.
- Open the Workflow tab.
- Under "What workflow should the agent use?", select
GenericAgentWorkflow. - Set the workflow fields:
| Field | Value |
|---|---|
| Workflow name | MAA-Workflow (or keep the default Agent-Workflow) |
| Workflow package name | foundationallm_agent_plugins |
| Workflow class name | FoundationaLLMFunctionCallingWorkflow |
| Workflow host | LangChain |
Select the workflow before you set Max rounds on Basic Settings, because selecting a workflow on a new agent resets the workflow properties.
Part 2: Basic Settings
On the Basic Settings tab:
| Field | Value |
|---|---|
| Agent Display Name | A user-friendly name, for example GPT-4o Analysis Agent |
| Agent name | A unique name, for example gpt4o-maa-agent (wait for ✔️) |
| Description | The purpose of the agent |
| Main model | Your GPT-4o model |
| Max rounds | Optional. For example 5 to allow several tool-calling rounds. Leave 0 for a single round. |
| Enable tool escalation | Optional |
| What is the main workflow prompt? | Your agent's system prompt |
Example main workflow prompt:
You are an analysis assistant that answers questions about the user's files and data.
Use the available tools when you need to read uploaded files or run calculations.
Provide concise, accurate answers.
Part 3: Set the Workflow Model Temperature
When you select the GPT-4o model, its parameters are copied into Workflow main model parameters on the Workflow tab. To give the workflow model its own temperature:
- Open the Workflow tab.
- Next to Workflow main model parameters, select the add icon.
- In Create Property, enter:
- Property Key:
temperature - Property Type: Number
- Property Value:
0.5
- Property Key:
- Select Save.
If temperature is already in the list (copied from the model), edit that entry instead. These parameters apply to the workflow model only; tools use their own Main Model reference.
Part 4: Add the Workflow Prompts
The FoundationaLLMFunctionCallingWorkflow class requires a router prompt. The files and final prompts are optional but recommended for this agent.
On the Workflow tab, add each resource under Additional workflow resources:
- Select the add icon.
- Set Resource Type to Prompt.
- Type at least three characters to search, then select the prompt.
- Enter the Resource Role.
- Select Save.
| Resource Role | Prompt |
|---|---|
router_prompt |
Platform-Agent-Workflow-Router-Multi-Round if Max rounds is above 0, otherwise Platform-Agent-Workflow-Router |
files_prompt |
Platform-Agent-Workflow-Files |
final_prompt |
Platform-Agent-Workflow-Final |
The platform router prompts list the agent's tools automatically, so tool names don't need to match the prompt text. To customize the instructions, create your own prompts with the Agent Workflow category under Agents > Prompts and select those instead.
Part 5: Allow File Uploads
On the Portal Experience tab, set Would you like to allow the user to upload files? to Yes.
Part 6: Add the Code Tool
- Open the Tools tab and select Add Tool.
- In the Tool Library, expand the FoundationaLLM family, select Select next to Code, and select Add to Agent.
- In the Edit Agent Tool: Code dialog:
| Section | Setting | Value |
|---|---|---|
| Basics | Name | Code (default) |
| Resource References | Main Model | Your GPT-4o model |
| Resource References | Main Prompt | Platform-Agent-Tool-Code-Main (default) |
| Resource References | Router Prompt | Platform-Agent-Tool-Code-Router (default) |
| Settings | Code Session Required | true (default) |
| Settings | Code Session Language | Python (default) |
| Settings | Code Session Provider | AzureContainerAppsCustomContainer (default) |
- (Optional) Set Temperature under Main Model for the tool's model calls. The field shows
0.2, but a value is stored only when you change it; otherwise the AI model's own parameters apply. - Select Save changes.
Part 7: Add the Knowledge Tool
- Select Add Tool again.
- In the FoundationaLLM family, select Select next to Knowledge, and select Add to Agent.
- In the Edit Agent Tool: Knowledge dialog:
| Section | Setting | Value |
|---|---|---|
| Basics | Name | Knowledge (default) |
| Resource References | Main Model | Your GPT-4o model |
| Resource References | Main Prompt | Platform-Agent-Tool-Knowledge-Main (default) |
| Resource References | Router Prompt | Platform-Agent-Tool-Knowledge-Router (default) |
| Resource References | Rewrite Prompt | Platform-Agent-Tool-Knowledge-Rewrite (default, optional) |
| Resource References | File Upload Data Pipeline | DefaultFileUpload (default) |
| Resource References | Conversation Knowledge Unit | Conversations (default) |
| Resource References | Agent Private Store Knowledge Unit | AgentPrivateStores (default) |
| Resource References | Knowledge Source | Agents (default) |
- Keep the default Settings (for example Vector Store Provider =
conversation). - Select Save changes.
The Tools available to the agent table now lists Code and Knowledge. For more on the tool editor, see Tools.
Part 8: Create the Agent
- Select Create Agent at the top right.
- If a required field is missing, the editor switches to the tab with the problem.
- When the message "Agent "[name]" was successfully created!" appears, the portal returns to the Agents page.
Testing Your Agent
- Open the User Portal and select your new agent.
- Test file upload and knowledge search:
- Upload a document (PDF, Word, and so on).
- Ask questions about its content.
- Test the Code tool:
- Ask for a calculation or data analysis.
- Ask for a chart or a generated file.
Troubleshooting
"No router prompt found in workflow configuration"
Add a workflow resource with the router_prompt role (Part 4).
Tools are never selected
- Confirm both tools appear in Tools available to the agent.
- Confirm the router prompt is attached with the role
router_prompt. - If Max rounds is above 0, use
Platform-Agent-Workflow-Router-Multi-Round.
File upload is not available in the User Portal
- Set Would you like to allow the user to upload files? to Yes on the Portal Experience tab.
- Confirm the Knowledge tool's File Upload Data Pipeline reference points to an existing pipeline (
DefaultFileUploadby default).
Code execution fails
- Check the code session provider configuration for your instance.
- Confirm Code Session Provider in the Code tool's Settings matches an available provider.