Skip to main content

Robot Framework AI Agent

A Robot Framework library to talk to modern LLMs from your test cases and tasks.

Why use this?

  • Provider-agnostic: choose from OpenAI, Anthropic, Google Gemini, Vertex AI, Mistral, Groq, Cohere, Bedrock, and Hugging Face – all through pydantic-ai-slim.
  • Structured outputs: ask the model to return strongly-typed results (e.g., a dataclass with fields). No more regex parsing.
  • Message history made simple: by default, each Chat call continues from the previous call in the same test case.
  • Per-call overrides: switch models and settings on the fly for a single step without re-importing the library.
  • Multiple agents: import the library more than once under different aliases to create multi-agent scenarios.
  • Tools and integrations: pass tools / builtin tools / toolsets from pydantic-ai-slim so agents can call functions and integrations you allow (including bridging to Robot keywords).

Design goals

  • Keep the surface area small: one core keyword (Chat) and a few helpers.
  • Be provider-agnostic and allow per-step model switching.
  • Make typed outputs first-class to enable stable assertions in tests.
  • Keep conversations local to a test (no surprise cross-test leakage).

Project status and scope

The project is in an early stage (v0.2.0). The core library is intentionally small and focused. It currently exposes:

  • Chat – the primary keyword to talk to LLMs (strings or typed outputs)
  • History helpers:
    • Get Message History (use content=FULL|NEWEST and format=RAW|JSON)
    • Clear Message History
  • Tool and toolset support via pydantic-ai-slim (including MCP integration)
  • Plugin-based tool discovery via entry_points

The examples found under examples/ are illustrative only; they are not project features.

Compatibility

  • Python: >= 3.11
  • Robot Framework: >= 7.0

Installation

robotframework-aiagent is a meta package, that installs everything you need to get started with the library, that means it installs every available provider and some other dependencies like mcp support.

To install robotframework-aiagent, run:

pip install robotframework-aiagent

or with uv:

uv pip install robotframework-aiagent

if you want to use specific providers or features, you can install the slim version with extras. This reduces the overall package size by excluding unused providers, features and dependencies.

# pip
pip install "robotframework-aiagent-slim[openai,mcp]"

# or with uv
uv pip install "robotframework-aiagent-slim[openai,mcp]"

You only need to enable extras for the providers you actually plan to use.

Which package should I use?

  • robotframework-aiagent: fastest start, all providers and optional features included.
  • robotframework-aiagent-slim[openai,mcp]: smaller install, only the providers and features you enable.
  • Use -slim in CI to keep images smaller and installs faster.

Quickstart

Minimal hello and per-step model override.

*** Settings ***
Library    AIAgent.Agent    openai:gpt-5.4-mini

*** Test Cases ***
Say Hello
  Chat    Hello, I am a Robot Framework test.
  Chat    What can you do?    model=google:gemini-2.5-flash-lite

Provider credentials

Set the appropriate environment variables for your chosen provider(s) before running Robot. Typical variables include (non-exhaustive):

  • OpenAI: OPENAI_API_KEY
  • Anthropic: ANTHROPIC_API_KEY
  • Google Gemini: GOOGLE_API_KEY
  • Vertex AI: use your GCP credentials (e.g., GOOGLE_APPLICATION_CREDENTIALS) and project setup
  • Mistral: MISTRAL_API_KEY
  • Cohere: COHERE_API_KEY
  • Groq: GROQ_API_KEY
  • AWS Bedrock: standard AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, region, etc.)
  • Hugging Face: HUGGINGFACE_API_KEY (or a token)

If you use RobotCode, you can keep these in a local .robot.toml (ignored by git) or in robot.toml and let RobotCode set them via its env section. See https://robotcode.io/02_get_started/configuration and https://robotcode.io/03_reference/config.

Example .robot.toml:

[env]
OPENAI_API_KEY = "${OPENAI_API_KEY}"
ANTHROPIC_API_KEY = "${ANTHROPIC_API_KEY}"
GOOGLE_API_KEY = "${GOOGLE_API_KEY}"

Refer to the respective provider documentation for the full and current requirements; pydantic-ai-slim follows the providers’ standard auth conventions.

Examples and guides

What you can build (use cases)

The focus is running everything directly inside Robot test cases and suites. Typical patterns:

Within that scope, useful scenarios include:

  • Test data and fixtures

    • Generate realistic inputs (texts, personas, edge-case strings) for downstream steps.
    • Produce strict payloads (JSON-like) using output_type to avoid brittle parsing.
  • Tool-augmented agents and MCP (when configured)

    • Use tools and (optionally) MCP-exposed services to fetch facts, call web services, generate JSON, or interact with systems.
    • Pair with Browser/Playwright/Selenium tools to drive UI steps directly from natural language; write the intent and execute. This can reduce upfront locator hunting if your UI library supports resilient selectors.
    • Bridge to Robot keywords via tools so agents can propose and execute actions under your allow-list.
    • Keep the final result typed for assertions in the same test.
  • Information extraction and classification

    • Pull entities, tables, statuses, PII flags, or categories from unstructured logs and responses.
    • Use typed outputs for stable downstream assertions.
  • Acceptance-check oracles and heuristics

    • Evaluate responses against explicit criteria; return a boolean verdict plus rationale.
    • Summarize UI/API outputs into concise, assertable statements.
  • Log triage and defect reporting

    • Condense noisy logs into concise summaries; propose likely root causes or next debug steps.
    • Generate human-readable failure notes as test artifacts.
  • Document QA and compliance

    • Ask targeted questions of attached docs; detect PII/compliance violations and return structured findings.
  • Multimodal analysis (model-dependent)

    • Attach images/screenshots for visual QA (e.g., detect missing labels, contrast issues, text-in-image).
    • Send audio/video snippets for transcription/summary; attach documents (PDF/Doc) for summary or extraction.
  • Decision routing and model selection

    • Let an agent route a case to the right sub-flow or decide which model/provider to use next.
    • Switch models locally per step without changing suite-wide defaults.
  • Multi-agent workflows and simulations

    • Red-team/blue-team, user/assistant, reviewer/author; each agent can have distinct models and instructions.
    • Useful for adversarial prompts, policy reviews, or role-play testing.
    • Distribute steps across specialized agents and keep per-agent histories isolated within a test.

What gets logged

Every Chat writes its course into the Robot Framework log:

  • The model's answer, its thinking (folded away) and structured outputs as JSON.
  • Tool calls and their results. Long results are cut down and logged completely as DEBUG.
  • Retries with their reason, e.g. a tool asking for another attempt or an output that failed validation.
  • A usage line: requests, tool calls, tokens and the answering model.
  • Images and other files from prompts, tool results (e.g. browser screenshots) and model output are stored in an aiagent folder of the output directory and shown as previews instead of being written into the log.

Roadmap / Upcoming features

Planned or potential additions based on the current design and dependencies:

  • Mode-specific keywords and defaults
    • Chat (exists today), Ask, Edit, Agent, Verify, plus custom modes
    • Edit: text transforms (summarize/translate/rewrite) and patch-like outputs
    • Agent: multi-step orchestration and tool/keyword execution
    • Verify: validations with typed verdicts
    • Extensibility: define custom modes/keywords with your own defaults and outputs
  • Configurable history storage (per test/suite) and easy transcript export/attachment to Robot reports
  • Global defaults via Robot variables, suite-level settings, and/or TOML configuration
  • Built-in convenience schemas for common structured outputs
  • Enhanced error reporting and retry policies surfaced as settings
  • Budget manager keywords around usage_limits and usage
  • Configurable debug logging for provider HTTP traffic

Contributing

PRs and issues are welcome. Suggested setup:

# Sync the multi-project workspace (incl. dev groups and extras)
uv sync --dev --all-packages --all-groups --all-extras

# Lint and type-check
uv run ruff check . && uv run ruff format --check .
uv run mypy .

# Run example tests (paths and output dir come from robot.toml, API keys from your .robot.toml)
uv run --all-packages robotcode run

All workspace packages share one static version (set in each pyproject.toml) and pin each other exactly. Releases are managed with Commitizen, which bumps all packages, their pins and uv.lock in one go:

# Preview the next version without changing files
uv run cz bump --dry-run

# Create a release commit + tag
uv run cz bump

If you have suggestions or want to contribute, issues and PRs are welcome.

Metadata

Release files for robotframework-aiagent 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-aiagent 0.4.0
File Size Uploaded Provenance Actions
robotframework_aiagent-0.4.0.tar.gz 14.8 kB Without provenance Details for robotframework_aiagent-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-aiagent 0.4.0
File Interpreter ABI Platform Actions
robotframework_aiagent-0.4.0-py3-none-any.whl Python 3 none any Details for robotframework_aiagent-0.4.0-py3-none-any.whl

Total release size: 24.7 kB

Release files / robotframework_aiagent-0.4.0.tar.gz

Download URL robotframework_aiagent-0.4.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a2f6244e12787fa28718a825f3e30f58ef6626e5028174f35bce4bf8cb62f2a1
BLAKE2b-256 checksum
How to use checksums
def2ecbb856e0965f2097caedd72dab1e3f258037be10b68d832a264fb646418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / robotframework_aiagent-0.4.0-py3-none-any.whl

Download URL robotframework_aiagent-0.4.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3db2a0582740c5fb2210cfabbb817830c9db75603686f2a60bdbb0534e572ff4
BLAKE2b-256 checksum
How to use checksums
7a1ead5b2c6099feaa022ba1a83a1878699e8c773e463a6ce4392368b0fe7c14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for robotframework-aiagent 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page