DocumentationFramework Integration

Framework Integration

Map your agent framework’s concepts to Invarium blueprints — 5 frameworks supported, plus any custom implementation.

Key Takeaways
  • Invarium is framework-agnostic — any agent with tools can be tested
  • Each framework maps its concepts differently: LangChain chains become workflows, CrewAI tasks become tools
  • The blueprint format is the common language — learn the mapping for your framework

Why It Matters

Framework integration translates your agent framework’s native concepts — decorators, agent classes, crew tasks, function definitions — into the universal blueprint format (YAML via MCP, JSON via Dashboard) that Invarium uses for test generation and behavioral auditing.

Every framework has its own conventions for defining tools, composing workflows, and specifying agent behavior. This guide shows you how to translate those conventions into a blueprint so Invarium can understand and test your agent regardless of how it was built.

The blueprint examples below use JSON format, which is used for Dashboard import. When working via MCP, your IDE assistant generates YAML format with the same schema. The structure and field names are identical — only the syntax differs.


Framework Overview

Invarium recognizes 6 framework values in the framework field. Setting the correct framework helps Invarium tailor test scenarios to framework-specific patterns.

Frameworkframework valueAgent modelTool definitionMulti-agent
LangChainlangchainAgentExecutor, LCEL chains@tool decorator, Tool classLangGraph
CrewAIcrewaiCrew of agents with roles@tool decoratorBuilt-in (crews)
AutoGenautogenConversable agentsFunction definitionsBuilt-in (group chat)
OpenAI Agents SDKopenai_agentsAgent classFunction tools, @function_toolHandoffs
CustomcustomAny implementationAny callableVaries
OpenAI (direct)openaiDirect API usageFunction callingManual orchestration

Framework Guides

LangChain

Concept Mapping

LangChain ConceptBlueprint FieldNotes
Agent nameagent_nameUse the name you give your agent or chain
@tool decorated functionstools[]One blueprint tool per @tool function
Tool class instancestools[]Map name, description, and args_schema
System prompt rulesconstraints.guardrails[]Extract each rule as a separate constraint
System prompt textconstraints.system_prompt_summaryPaste or summarize your system prompt
LCEL chain / graph stepsworkflow.chains[]Map each chain or graph to a workflow
LangGraph nodesworkflow.chains[].steps[]Each node becomes a step in the workflow

Example: LangChain Agent Blueprint

Given this LangChain agent:

@tool
def search_products(query: str) -> str:
    """Search the product catalog by name or category."""
    # ...
 
@tool
def check_inventory(product_id: str) -> dict:
    """Check current inventory levels for a product."""
    # ...
 
@tool
def place_order(product_id: str, quantity: int, customer_id: str) -> str:
    """Place an order for a product."""
    # ...

The blueprint would be:

{
  "agent_name": "ecommerce-assistant",
  "framework": "langchain",
  "description": "An e-commerce assistant that helps customers search products, check availability, and place orders.",
  "tools": [
    {
      "name": "search_products",
      "description": "Search the product catalog by name or category.",
      "parameters": {
        "type": "object",
        "properties": {
          "query": { "type": "string", "description": "Product name, category, or search terms" }
        },
        "required": ["query"]
      },
      "returns": "List of matching products with name, price, and ID.",
      "side_effects": ["database_read"],
      "error_handling": "retry"
    },
    {
      "name": "check_inventory",
      "description": "Check current inventory levels for a specific product.",
      "parameters": {
        "type": "object",
        "properties": {
          "product_id": { "type": "string", "description": "The unique product identifier" }
        },
        "required": ["product_id"]
      },
      "returns": "Object with product_id, available_quantity, and warehouse_location.",
      "side_effects": ["database_read"],
      "error_handling": "retry"
    },
    {
      "name": "place_order",
      "description": "Place an order for a product on behalf of the customer.",
      "parameters": {
        "type": "object",
        "properties": {
          "product_id": { "type": "string", "description": "The product to order" },
          "quantity": { "type": "integer", "description": "Number of units to order (1-100)" },
          "customer_id": { "type": "string", "description": "The customer placing the order" }
        },
        "required": ["product_id", "quantity", "customer_id"]
      },
      "returns": "Order confirmation with order_id and estimated delivery date.",
      "side_effects": ["payment", "database_write"],
      "requires_confirmation": true,
      "error_handling": "fallback"
    }
  ],
  "constraints": {
    "system_prompt_summary": "You are an e-commerce assistant. Help customers find products, check stock, and place orders.",
    "guardrails": [
      "Always check inventory before placing an order",
      "Never place an order without the customer's explicit confirmation",
      "Do not recommend products that are out of stock",
      "Only discuss products available in our catalog"
    ]
  },
  "workflow": {
    "entry_point": "customer_request",
    "chains": [
      {
        "name": "purchase-flow",
        "steps": [
          "Search for the product in the catalog",
          "Check inventory for the matching product",
          "If in stock, confirm the order details with the customer",
          "Place the order after customer confirmation"
        ],
        "condition": "Customer wants to buy a product"
      }
    ]
  }
}

LangChain Tips

  • Map each @tool decorated function to a tools[] entry — the docstring becomes the description
  • Extract constraints from your system prompt — every rule in the system prompt should be a separate constraint
  • If you use LangGraph, map each node to a step in a workflow.chains[] entry
  • Include side_effects for any tool that writes data or triggers external actions — search_products reads the database, place_order processes a payment
  • Set requires_confirmation: true on tools that perform irreversible actions (like placing orders or sending emails)

Common Patterns

Regardless of framework, these patterns apply to every blueprint:

Every Callable is a Tool

If your agent can call it, list it in tools[]. This includes functions, API endpoints, database queries, and external service calls. Each tool needs at minimum a name and description.

Every Rule is a Constraint

System prompts, guardrails, and business rules all become entries in constraints. Extract individual rules from your system prompt — “Always check inventory before ordering” is one constraint, “Never process payments without confirmation” is another. The more specific your constraints, the more targeted your test scenarios.

Every Multi-Step Process is a Workflow

If your agent follows a sequence of steps to complete a task, describe it in workflow.chains[]. Workflows help Invarium test your agent’s end-to-end behavior, not just individual tool calls.

Be Specific About Side Effects

Tools that only read data have "side_effects": ["none"] or "side_effects": ["database_read"]. Tools that write data, send messages, or trigger external systems need their side effects documented with specific values:

Side EffectWhen to Use
database_writeTool creates, updates, or deletes database records
database_readTool queries a database
api_callTool calls an external API
email_sendTool sends an email
file_writeTool creates or modifies files
file_readTool reads files from disk
paymentTool processes a financial transaction
notificationTool sends a push notification, SMS, or alert
noneTool has no side effects (pure computation)

Not sure if your blueprint is complete? Upload it and generate a small set of 5-10 test scenarios. If the tests feel generic or miss important behaviors, your blueprint needs more detail in tools, constraints, or workflows.