> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meibel.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Agent



## OpenAPI

````yaml /api-v2.json put /agents/{agent_id}
openapi: 3.1.0
info:
  title: Meibel AI API
  summary: Meibel Gateway Service
  description: >-
    Our API allows you to interact with our services. Read the
    [docs](https://docs.meibel.ai) to learn how to use it.
  version: 0.6.4
servers:
  - url: https://api.meibel.ai/v2
    description: Meibel API (v2)
  - url: https://api.dev.meibel.ai/v2
    description: Meibel Dev API (v2)
  - url: http://localhost:8000/v2
    description: Local Development
security: []
tags:
  - name: Datasources
    description: v2 datasource management
  - name: Data Elements
    description: v2 data element CRUD and search
  - name: File Upload
    description: Upload files to a datasource and track upload progress
  - name: Ingest
    description: Trigger and monitor datasource ingestion
  - name: Datasource Downloads
    description: Export all datasource content as a zip archive
  - name: Table Descriptions
    description: v2 table and column descriptions
  - name: Metadata Model Catalog
    description: v2 metadata model catalog
  - name: Confidence Scoring
    description: v2 confidence scoring jobs and summaries
  - name: Documents
    description: Parse and transform documents into structured data
  - name: Agents
    description: Agent definition management
  - name: Sessions
    description: Agent session (execution) management and chat
  - name: Execution Policies
    description: Data access and tool usage constraints scoped to agent sessions
  - name: Artifact Schemas
    description: Agent artifact schema management
paths:
  /agents/{agent_id}:
    put:
      tags:
        - Agents
      summary: Update Agent
      operationId: updateAgent
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgentDefinitionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateAgentDefinitionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            import os
            from meibel import MeibelClient
            from meibel.models import UpdateAgentDefinitionRequest

            client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])

            request = UpdateAgentDefinitionRequest(
                display_name="Customer Support Agent",
                instructions="You are a helpful customer support agent for Acme Corp.",
                llm_model="gpt-4o",
                temperature=0.3,
                max_tokens=2048,
                tags=["support", "production"],
            )

            response = client.agents.update("agent_abc123", request)

            print(f"Updated agent {response.id}, version {response.version}")
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from "meibel";


            const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY
            });


            const updatedAgent = await client.agents.update("agent_abc123", {
              display_name: "Support Assistant",
              instructions: "You are a helpful customer support agent for Acme Corp. Be concise and friendly.",
              llm_model: "gpt-4o",
              temperature: 0.3,
              max_tokens: 2048,
              tools: [
                {
                  name: "search_knowledge_base",
                  type: "rag_search",
                  description: "Search the support knowledge base for relevant articles",
                  config: { datasource_id: "ds_kb_9f8e7d6c" },
                  use_for: ["answering product questions", "troubleshooting steps"],
                },
              ],
              execution_policy: {
                datasources: {
                  ds_kb_9f8e7d6c: {
                    documents: {
                      filter: { "data_element.__name__": { $nin: ["internal_notes.pdf"] } },
                    },
                  },
                },
              },
              tags: ["support", "production"],
            });


            console.log(`Updated agent ${updatedAgent.id} to version
            ${updatedAgent.version}`);

            console.log(`Catalog URN: ${updatedAgent.catalog_urn}`);
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tv2 \"github.com/meibel-ai/meibel-go/v2\"\n)\n\nfunc main() {\n\tclient := v2.NewClient(v2.WithAPIKey(os.Getenv(\"MEIBEL_API_KEY\")))\n\n\tresp, err := client.Agents.Update(context.Background(), \"agent_abc123\", v2.UpdateAgentDefinitionRequest{\n\t\tDisplayName: v2.String(\"Support Assistant\"),\n\t\tInstructions: v2.String(\"You are a helpful customer support agent for Acme Corp.\"),\n\t\tLlmModel:    v2.String(\"gpt-4o\"),\n\t\tTemperature: v2.Float64(0.3),\n\t\tMaxTokens:   v2.Int(2048),\n\t\tTools: []v2.AgentToolDefinition{\n\t\t\t{\n\t\t\t\tName:        \"order_lookup\",\n\t\t\t\tType:        \"database_query\",\n\t\t\t\tDescription: v2.String(\"Look up order details by order ID\"),\n\t\t\t\tConfig: map[string]any{\n\t\t\t\t\t\"datasource_id\": \"ds_orders_prod\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tTags: []string{\"support\", \"production\"},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"Updated agent %s to version %s\\n\", resp.ID, resp.Version)\n}"
components:
  schemas:
    UpdateAgentDefinitionRequest:
      properties:
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Human-readable name of the agent
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
          description: System prompt/instructions
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Agent type
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the agent
        llm_model:
          anyOf:
            - type: string
            - type: 'null'
          title: Llm Model
          description: LLM model to use
        fallback_models:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Fallback Models
          description: List of fallback models
        datasources:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Datasources
          description: Datasource IDs the agent has access to
        tools:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentToolDefinition'
              type: array
            - type: 'null'
          title: Tools
          description: Tools configuration
        artifacts:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Artifacts
          description: Catalog URNs of artifacts the agent produces
        confidence_configs:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Confidence Configs
          description: Confidence scoring module names to apply during execution
        temperature:
          anyOf:
            - type: number
              maximum: 2
              minimum: 0
            - type: integer
              maximum: 2
              minimum: 0
            - type: 'null'
          title: Temperature
          description: LLM temperature
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Tokens
          description: Maximum tokens in response
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
          description: Tags for categorization
        icon:
          anyOf:
            - type: string
            - type: 'null'
          title: Icon
          description: UI icon identifier
        execution_policy:
          anyOf:
            - $ref: '#/components/schemas/ExecutionPolicy'
            - type: 'null'
          description: Inline execution policy constraints (datasources, tools)
        execution_policy_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Execution Policy Ids
          description: IDs of stored ExecutionPolicies to compose
      type: object
      title: UpdateAgentDefinitionRequest
      description: >-
        Request model for updating an agent definition. Name is intentionally
        excluded as it serves as the stable identifier for a version chain and
        cannot be changed.
    UpdateAgentDefinitionResponse:
      properties:
        id:
          type: string
          title: Id
          description: New agent definition ID
        catalog_urn:
          type: string
          title: Catalog Urn
          description: Catalog URN for the new version
        version:
          type: string
          title: Version
          description: New version number
      type: object
      required:
        - id
        - catalog_urn
        - version
      title: UpdateAgentDefinitionResponse
      description: Response model for updating an agent definition.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentToolDefinition:
      properties:
        name:
          type: string
          title: Name
          description: Instance name - what the LLM sees and calls
        type:
          type: string
          title: Type
          description: 'Tool type: rag_search, database_query, etc.'
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description shown to LLM
          default: ''
        config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Config
          description: >-
            Tool config passed to activity via tool_context (datasource_id,
            base_prompt, etc.)
        parameters_schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Parameters Schema
          description: Optional override for the tool's parameters schema
        use_for:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Use For
          description: When to use this tool (injected into system prompt)
        avoid_for:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Avoid For
          description: When NOT to use this tool (injected into system prompt)
        require_approval:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Require Approval
          description: >-
            If true, workflow pauses for human approval before executing this
            tool
          default: false
        approval_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Approval Message
          description: >-
            Message to display when requesting approval (supports {{variable}}
            templates)
      type: object
      required:
        - name
        - type
      title: AgentToolDefinition
      description: AgentToolDefinition
    ExecutionPolicy:
      properties:
        datasources:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/DatasourceView'
              type: object
            - type: 'null'
          title: Datasources
          description: >-
            Per-datasource access controls, keyed by datasource_id. Each entry
            can disable the datasource entirely or apply TAG/RAG filters to
            restrict which data is accessible.
        tools:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/ToolConfig'
              type: object
            - type: 'null'
          title: Tools
          description: >-
            Per-tool access controls, keyed by tool instance name. Each entry
            can disable the tool entirely or constrain its parameters to
            specific values or ranges.
      type: object
      title: ExecutionPolicy
      description: >-
        Session-level access constraints (hardrails) for data and tools. 
        Controls what data an agent session can access and what tools it can
        use. Constraints are enforced by the platform at runtime — the agent
        cannot bypass them.  Multiple policies can be composed: stored policies
        (by ID) and/or an inline policy are structurally merged. Overlapping
        datasource or tool entries are combined with ``$and`` (intersection
        semantics).  All filter fields use MongoDB-style constraint operators.
        Plain values are automatically normalized to ``{"$eq": value}``.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    DatasourceView:
      properties:
        disabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Disabled
          description: >-
            When true, the datasource is entirely inaccessible for this session.
            All queries against it will be blocked.
        tables:
          anyOf:
            - $ref: '#/components/schemas/TagConstraints'
            - type: 'null'
          description: >-
            TAG (SQL/database) constraints. Controls table/row access and column
            redaction.
        documents:
          anyOf:
            - $ref: '#/components/schemas/RagConstraints'
            - type: 'null'
          description: >-
            RAG (vector search) constraints. Controls which documents can be
            retrieved.
      type: object
      title: DatasourceView
      description: >-
        Access controls for a single datasource.  Each datasource can be
        entirely disabled, or selectively constrained via TAG (SQL) and/or RAG
        (vector search) filters. Keyed by datasource_id in
        ``ExecutionPolicy.datasources``.
    ToolConfig:
      properties:
        disabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Disabled
          description: >-
            When true, the tool is removed from the agent's toolkit for this
            session. The agent will not be able to invoke it.
        variables:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Variables
          description: Optional override for the tool's parameters schema
      type: object
      title: ToolConfig
      description: >-
        Access controls for a single tool instance.  Tools can be entirely
        disabled, or have their parameters constrained to specific values or
        ranges. Keyed by tool instance name in ``ExecutionPolicy.tools``. 
        Variable constraints use the same MongoDB-style operators as datasource
        filters. Plain values are automatically normalized to ``{"$eq": value}``
        on construction. All constraints are:   1. Annotated in the tool's
        parameter schema (visible to the LLM)   2. Validated at execution time
        (enforced by the platform)  Supported operators:   - Comparison:
        ``$eq``, ``$ne``, ``$gt``, ``$gte``, ``$lt``, ``$lte``   - Set: ``$in``,
        ``$nin``   - Logical: ``$and``, ``$or``, ``$not``
    TagConstraints:
      properties:
        filter:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Filter
          description: Optional override for the tool's parameters schema
        hidden_columns:
          anyOf:
            - additionalProperties:
                items:
                  type: string
                type: array
              type: object
            - type: 'null'
          title: Hidden Columns
          description: >-
            Per-table column names to redact from query output. Keyed by table
            name; values are lists of column names. Columns remain usable in
            WHERE/JOIN — only the final result values are stripped.
        hidden_tables:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Hidden Tables
          description: >-
            Table names whose columns are fully redacted from query output.
            Tables remain queryable in WHERE/JOIN — only SELECT output is
            stripped.
      type: object
      title: TagConstraints
      description: >-
        Constraints for TAG (SQL/database) queries within a datasource. 
        Controls which tables and rows the agent can access, and which columns
        are redacted from query output.  Filters use MongoDB-style constraint
        dicts. Plain values are automatically normalized to ``{"$eq": value}``
        on construction.  Supported operators:   - Comparison: ``$eq``, ``$ne``,
        ``$gt``, ``$gte``, ``$lt``, ``$lte``   - Set: ``$in``, ``$nin``   -
        Logical: ``$and``, ``$or``, ``$not``
    RagConstraints:
      properties:
        filter:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Filter
          description: Optional override for the tool's parameters schema
      type: object
      title: RagConstraints
      description: >-
        Constraints for RAG (vector search) queries within a datasource. 
        Controls which documents the agent can retrieve via vector search. 
        Filters use MongoDB-style constraint dicts. Plain values are
        automatically normalized to ``{"$eq": value}`` on construction. 
        Built-in fields:   - ``data_element.__id__``: scope by data element ID  
        - ``data_element.__name__``: scope by original filename  Custom indexed
        metadata fields (e.g., ``author``, ``document_type``) are also supported
        when configured on the datasource.  Supported operators:   - Comparison:
        ``$eq``, ``$ne``, ``$gt``, ``$gte``, ``$lt``, ``$lte``   - Set: ``$in``,
        ``$nin``   - Logical: ``$and``, ``$or``, ``$not``
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````