# ResponsesAgentNode

> **Class** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/agents/_v2/base/ResponsesAgentNode)

A LangGraph node for an existing Azure AI Foundry agent (V2 Responses API).

This node wraps a prompt-based agent that has already been created in Azure AI
Foundry. It handles building requests and processing responses using the V2
Responses/Conversations API.

Use :meth:`~langchain_azure_ai.agents.v2.AgentServiceFactory.create_prompt_agent_node`
to create an agent and obtain a node in a single step, or instantiate this
class directly to reference an existing agent by name.

Example:
```python
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
from langchain_azure_ai.agents.prebuilt import ResponsesAgentNode

client = AIProjectClient(
    endpoint="https://resource.services.ai.azure.com/api/projects/demo-project",
    credential=DefaultAzureCredential(),
)

coder = ResponsesAgentNode(
    client=client,
    name="code-interpreter-agent",
    version="latest",
)
```

## Signature

```python
ResponsesAgentNode(
    self,
    client: AIProjectClient,
    name: str,
    version: str = 'latest',
    uses_container_template: bool = False,
    extra_headers: Optional[Dict[str, str]] = None,
    tags: Optional[Sequence[str]] = None,
    trace: bool = True,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `client` | `AIProjectClient` | Yes | The AIProjectClient instance. |
| `name` | `str` | Yes | The name of the agent in Azure AI Foundry. The node will fetch the requested version from the service during initialization. |
| `version` | `str` | No | The version of the agent to use. Defaults to ``"latest"``, which resolves to the most recently published version. (default: `'latest'`) |
| `uses_container_template` | `bool` | No | Set to ``True`` when the agent definition uses the ``{{container_id}}`` structured-input template for the code interpreter. This is computed automatically by :meth:`~langchain_azure_ai.agents.v2.AgentServiceFactory.create_prompt_agent_node` when a :class:`~azure.ai.projects.models.CodeInterpreterTool` without a fixed container is present in the tool list. (default: `False`) |
| `extra_headers` | `Optional[Dict[str, str]]` | No | Optional HTTP headers to include in every ``responses.create()`` call. Typically collected from :attr:`~langchain_azure_ai.agents._v2.prebuilt.tools.AgentServiceBaseTool.extra_headers` on any :class:`~langchain_azure_ai.agents._v2.prebuilt.tools.AgentServiceBaseTool` instances passed to the factory. (default: `None`) |
| `tags` | `Optional[Sequence[str]]` | No | Optional tags for the runnable. (default: `None`) |
| `trace` | `bool` | No | Whether to enable tracing. (default: `True`) |

## Extends

- `RunnableCallable`

## Constructors

```python
__init__(
    self,
    client: AIProjectClient,
    name: str,
    version: str = 'latest',
    uses_container_template: bool = False,
    extra_headers: Optional[Dict[str, str]] = None,
    tags: Optional[Sequence[str]] = None,
    trace: bool = True,
) -> None
```

| Name | Type |
|------|------|
| `client` | `AIProjectClient` |
| `name` | `str` |
| `version` | `str` |
| `uses_container_template` | `bool` |
| `extra_headers` | `Optional[Dict[str, str]]` |
| `tags` | `Optional[Sequence[str]]` |
| `trace` | `bool` |


## Properties

- `name`
- `agent_id`

## Methods

- [`get_metadata()`](https://reference.langchain.com/python/langchain-azure-ai/agents/_v2/base/ResponsesAgentNode/get_metadata)
- [`delete_agent_from_node()`](https://reference.langchain.com/python/langchain-azure-ai/agents/_v2/base/ResponsesAgentNode/delete_agent_from_node)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/agents/_v2/base.py#L1014)