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

# External Integrations

> Connect Agent Composer to external systems and services

## Description

Agent Composer provides multiple ways to integrate with external systems, enabling agents to take actions, retrieve data, and interact with enterprise services.

## Integration Options

| Integration        | Use Case                               | Step Type             |
| ------------------ | -------------------------------------- | --------------------- |
| **MCP**            | Connect to MCP-compatible services     | `MCPClientStep`       |
| **Webhooks**       | Call REST APIs and trigger actions     | `WebhookStep`         |
| **Code Execution** | Run Python code for calculations       | `CodeExecutionStep`   |
| **Salesforce**     | Query Salesforce data                  | `SalesforceSOSLStep`  |
| **Web Search**     | Search the web for current information | `WebSearchStep`       |
| **Other Agents**   | Query other Contextual AI agents       | `ContextualAgentStep` |

## Salesforce Integration

Use `SalesforceSOSLStep` to execute SOSL searches against Salesforce:

```yaml theme={null}
salesforce_search:
  type: SalesforceSOSLStep
  config:
    client_id: "${SF_CLIENT_ID}"
    client_secret: "${SF_CLIENT_SECRET}"
    login_url: "https://login.salesforce.com"
    objects_to_return: "Case(Id, Subject, Status, Priority, Account.Name)"
    limit: 250
  input_mapping:
    query: __inputs__#query
```

### Salesforce Configuration

| Parameter           | Type  | Required | Description                                |
| ------------------- | ----- | -------- | ------------------------------------------ |
| `client_id`         | `str` | Yes\*    | Salesforce connected app client ID         |
| `client_secret`     | `str` | Yes\*    | Salesforce connected app client secret     |
| `login_url`         | `str` | No       | Salesforce login URL (default: production) |
| `objects_to_return` | `str` | No       | SOSL RETURNING clause                      |
| `limit`             | `int` | No       | Maximum results (default: `250`)           |
| `timeout`           | `int` | No       | Request timeout (default: `30`)            |

\*Alternative: Use `username`, `password`, and `security_token` for user-based auth.

## Web Search

Use `WebSearchStep` for real-time web information:

```yaml theme={null}
web_search:
  type: WebSearchStep
  config:
    model: "gemini-2.5-flash"
  input_mapping:
    query: __inputs__#query
```

### Web Search Outputs

| Output       | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `web_result` | `WebResult` | Search results with sources |

## Query Other Agents

Use `ContextualAgentStep` to retrieve information from other Contextual AI agents:

```yaml theme={null}
query_specialist:
  type: ContextualAgentStep
  config:
    agent_ids:
      - "agent-id-for-hr-docs"
      - "agent-id-for-legal-docs"
  input_mapping:
    query: __inputs__#query
```

This enables multi-agent architectures where specialized agents handle specific domains.

## Vision Language Models

Use `VisionLanguageModelStep` for multimodal inputs:

```yaml theme={null}
analyze_image:
  type: VisionLanguageModelStep
  config:
    model_id: "vertex_ai/gemini-2.0-flash"
    temperature: 0.0
    max_tokens: 4096
  input_mapping:
    query: __inputs__#query
    images: image_extractor#extracted_images
```

### VLM Configuration

| Parameter     | Type    | Default                        | Description             |
| ------------- | ------- | ------------------------------ | ----------------------- |
| `model_id`    | `str`   | `"vertex_ai/gemini-2.0-flash"` | Vision-capable model    |
| `temperature` | `float` | `0.0`                          | Response creativity     |
| `max_tokens`  | `int`   | `4096`                         | Maximum response length |

## Example: Multi-System Agent

```yaml theme={null}
version: 0.1
inputs:
  query: str

outputs:
  response: str

nodes:
  create_message_history:
    type: CreateMessageHistoryStep
    input_mapping:
      query: __inputs__#query

  research:
    type: AgenticResearchStep
    ui_stream_types:
      retrievals: true
    config:
      tools_config:
        # Internal documentation
        - name: search_docs
          description: Search internal documentation and policies.
          step_config:
            type: SearchUnstructuredDataStep
            config:
              top_k: 50

        # CRM data via MCP
        - name: search_crm
          description: Look up customer records and history.
          step_config:
            type: MCPClientStep
            config:
              server_url: "https://crm.example.com/mcp"
              tool_name: "search"
              tool_args: '{"query": "$query"}'
              auth_headers:
                Authorization: "Bearer ${CRM_TOKEN}"

        # Salesforce cases
        - name: search_salesforce
          description: Find support cases in Salesforce.
          step_config:
            type: SalesforceSOSLStep
            config:
              client_id: "${SF_CLIENT_ID}"
              client_secret: "${SF_CLIENT_SECRET}"
              objects_to_return: "Case(Id, Subject, Status)"

        # Real-time web info
        - name: search_web
          description: Search the web for current information.
          step_config:
            type: WebSearchStep

      agent_config:
        agent_loop:
          num_turns: 10
          model_name_or_path: "vertex_ai/claude-sonnet-4-5@20250929"
          research_guidelines_prompt: |
            Choose the appropriate tool based on the query:
            - `search_docs` for policies and procedures
            - `search_crm` for customer information
            - `search_salesforce` for support cases
            - `search_web` for current events or external info

    input_mapping:
      message_history: create_message_history#message_history

  generate:
    type: GenerateFromResearchStep
    ui_stream_types:
      generation: true
    config:
      model_name_or_path: "vertex_ai/claude-sonnet-4-5@20250929"
    input_mapping:
      message_history: create_message_history#message_history
      research: research#research

  __outputs__:
    type: output
    input_mapping:
      response: generate#response
```

## Related

* [MCP Integration](/reference/ac-mcp-integration)
* [Webhooks](/reference/ac-webhooks)
* [Code Execution](/reference/ac-code-execution)
* [Agentic Workflows](/reference/ac-agentic-workflows)
