# PromptBasedAgentNode

> **Class** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/agents/_v1/prebuilt/declarative/PromptBasedAgentNode)

A LangGraph node that represents a prompt-based agent in Azure AI Foundry.

You can use this node to create complex graphs that involve interactions with
an Azure AI Foundry agent.

You can also use `langchain_azure_ai.agents.AgentServiceFactory` to create
instances of this node.

Example:
```python
from azure.identity import DefaultAzureCredential
from langchain_azure_ai.agents import AgentServiceFactory

factory = AgentServiceFactory(
    project_endpoint=(
        "https://resource.services.ai.azure.com/api/projects/demo-project",
    ),
    credential=DefaultAzureCredential()
)

coder = factory.create_prompt_agent_node(
    name="code-interpreter-agent",
    model="gpt-4.1",
    instructions="You are a helpful assistant that can run Python code.",
    tools=[func1, func2],
)
```

## Signature

```python
PromptBasedAgentNode(
    self,
    client: AgentsClient,
    agent: Agent,
    name: str,
    polling_interval: int = 1,
    tags: Optional[Sequence[str]] = None,
    trace: bool = True,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `client` | `AgentsClient` | Yes | The AgentsClient instance to use. |
| `agent` | `Agent` | Yes | An existing agent retrieved from Azure AI Foundry. Use :meth:`~langchain_azure_ai.agents.v1.AgentServiceFactory.create_prompt_agent_node` to create a new agent and receive a pre-populated node. |
| `name` | `str` | Yes | The display name for this LangGraph node. |
| `polling_interval` | `int` | No | The interval (in seconds) to poll for updates on the agent's status. Defaults to 1 second. (default: `1`) |
| `tags` | `Optional[Sequence[str]]` | No | Optional tags to associate with the agent. (default: `None`) |
| `trace` | `bool` | No | Whether to enable tracing for the node. Defaults to True. (default: `True`) |

## Extends

- `RunnableCallable`

## Constructors

```python
__init__(
    self,
    client: AgentsClient,
    agent: Agent,
    name: str,
    polling_interval: int = 1,
    tags: Optional[Sequence[str]] = None,
    trace: bool = True,
) -> None
```

| Name | Type |
|------|------|
| `client` | `AgentsClient` |
| `agent` | `Agent` |
| `name` | `str` |
| `polling_interval` | `int` |
| `tags` | `Optional[Sequence[str]]` |
| `trace` | `bool` |


## Properties

- `name`
- `agent_id`

## Methods

- [`delete_agent_from_node()`](https://reference.langchain.com/python/langchain-azure-ai/agents/_v1/prebuilt/declarative/PromptBasedAgentNode/delete_agent_from_node)
- [`update_thread_resources()`](https://reference.langchain.com/python/langchain-azure-ai/agents/_v1/prebuilt/declarative/PromptBasedAgentNode/update_thread_resources)

## ⚠️ Deprecated

Deprecated since version 1.1.0. Use langchain_azure_ai.agents.prebuilt.PromptBasedAgentNode instead. `langchain_azure_ai.agents.v1.*` uses `azure-ai-agents` library which is deprecated. Use `langchain_azure_ai.agents.prebuilt.*` instead, which uses the new `azure-ai-projects` library.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/agents/_v1/prebuilt/declarative.py#L500)