Skip to content

agent

Repository: github.com/datarobot-community/af-component-agent

Adds an agentic workflow to your recipe. The component scaffolds a single-agent or multi-agent system using your choice of framework: CrewAI, LangGraph, LlamaIndex, or NeMo Agent Toolkit (NAT). It includes a local development server, a command-line interface for testing, a test suite, and Pulumi infrastructure for deployment to DataRobot.

This component is repeatable — apply it multiple times with different agent names to run multiple independent agentic workflows from a single recipe.

Prerequisites

  • Python 3.11+
  • uv and uvx installed
  • dr installed
  • The base component already applied
  • The llm component already applied
  • The datarobot-mcp component already applied

Apply

dr component add https://github.com/datarobot-community/af-component-agent .

Or with copier directly:

uvx copier copy https://github.com/datarobot-community/af-component-agent .

When prompted, choose your agent framework:

Framework When to use
base Minimal scaffold — bring your own agentic logic.
crewai Role-based multi-agent crews.
langgraph Graph-based stateful agent workflows.
llamaindex RAG and document-aware agent workflows.
nat YAML-based NeMo Agent Toolkit.

Component dependencies

Component Required
base Yes
llm Yes
datarobot-mcp No

base and llm are the component's declared dependencies. An MCP backend is optional: the agent picks one up automatically when an MCP instance named mcp_server is deployed alongside it, and otherwise reads MCP_DEPLOYMENT_ID or EXTERNAL_MCP_URL from the environment.

What it adds

agent/
├── agent/myagent.py   # Agent workflow — edit this to customize behavior
├── agent/register.py  # Wires the LLM, MCP tools, and workflow tools together
├── agent/config.py    # Settings and credential resolution
├── workflow.yaml      # NeMo Agent Toolkit config the DRAgent server loads
├── dev.py             # In-process entry point for an IDE debugger
├── Taskfile.yml       # dev, cli, test, lint
└── tests/             # Test suite
infra/infra/agent.py   # Pulumi deployment resources

The folder name is a copier answer; agent is the default. Apply the component again under a different name for a second, independently updatable agent.

Configure

dr dotenv setup

The wizard asks for:

  • Agent port (default: 8842).
  • DataRobot execution environment.
  • Execution environment version ID.
  • A memory provider key, if you chose Mem0.
  • Pulumi passphrase and default Use Case (from base).
  • LLM configuration (from llm).

Local development

Start the local server:

dr run dev

dr run dev starts the DRAgent server (nat dragent serve --config_file workflow.yaml) on AGENT_PORT, 8842 by default.

To run the workflow without a server, from another terminal:

dr run agent:cli -- execute --user_prompt "Write a blog post about AI in healthcare"

Testing

Run all tests:

task test

Test a specific framework:

task test-AGENT_FRAMEWORK

Test the CLI:

task test-cli

Deploy

dr run deploy

After deployment, the agent is available in the DataRobot workbench under your use case, accessible via the agent playground or the deployment API endpoint.

Customizing agent behavior

Edit agent/agent/myagent.py to:

  • Change agent roles and goals.
  • Modify task descriptions.
  • Add agents to the crew.
  • Integrate MCP tools.

Update

dr component update .datarobot/answers/agent-AGENT_APP_NAME.yml

Or with copier directly:

uvx copier update -a .datarobot/answers/agent-AGENT_APP_NAME.yml -A

End-to-end test

The component includes a full lifecycle end-to-end test (render → build → deploy → test → destroy):

task test-e2e

By default it tests all frameworks. To run a subset:

E2E_AGENT_FRAMEWORKS=base,crewai task test-e2e

Troubleshooting

uvx or dr command not found

Ensure both tools are installed and on your PATH. Run uv --version and dr --version to confirm.

Authentication errors at startup

Verify that DATAROBOT_ENDPOINT and DATAROBOT_API_TOKEN are set correctly and that the token has the required permissions.

Framework import errors

Some frameworks have optional heavy dependencies. Run task test-AGENT_FRAMEWORK to isolate the failing framework and check its dependency group in pyproject.toml.

E2E test failures

Confirm that your DataRobot account has access to the deployment target and that the Pulumi local backend is writable.