Skip to content

Commit bebe2dc

Browse files
authored
Merge branch 'v1.17' into workflow-retention-policy-notes
2 parents a06ceae + d181d12 commit bebe2dc

File tree

9 files changed

+442
-85
lines changed

9 files changed

+442
-85
lines changed

daprdocs/content/en/developing-ai/dapr-agents/dapr-agents-core-concepts.md

Lines changed: 97 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ aliases:
88
- /developing-applications/dapr-agents/dapr-agents-core-concepts
99
---
1010

11-
Dapr Agents provides a structured way to build and orchestrate applications that use LLMs without getting bogged down in infrastructure details. The primary goal is to enable AI development by abstracting away the complexities of working with LLMs, tools, memory management, and distributed systems, allowing developers to focus on the business logic of their AI applications. Agents in this framework are the fundamental building blocks.
11+
Dapr Agents provides a structured way to build and orchestrate applications that use LLMs without getting bogged down in infrastructure details and with durability guarantees. The primary goal is to enable AI development by abstracting away the complexities of working with LLMs, tools, memory management, and distributed systems, allowing developers to focus on the business logic of their AI applications. Agents in this framework are the fundamental building blocks.
1212

1313
## Agents
1414

@@ -19,7 +19,12 @@ Agents are autonomous units powered by Large Language Models (LLMs), designed to
1919
Dapr Agents provides two agent types, each designed for different use cases:
2020

2121
### Agent
22-
The standard `Agent` class is a conversational agent that manages tool calls and conversations using a language model. It provides, synchronous execution with built-in conversation memory.
22+
23+
{{% alert title="Deprecated" color="warning" %}}
24+
The `Agent` class is **deprecated as of v1.0.0-rc.1** and will be removed in a future release. Use [`DurableAgent`](#durable-agent) for all new development.
25+
{{% /alert %}}
26+
27+
The `Agent` class is a conversational agent that manages tool calls and conversations using a language model. It provides synchronous execution with built-in conversation memory.
2328

2429
```python
2530
@tool
@@ -103,10 +108,10 @@ This example demonstrates creating a workflow-backed agent that runs autonomousl
103108

104109
In Summary:
105110

106-
| Agent Type | Memory Type | Execution | Interaction Mode |
107-
|-----------------|-------------------------|-----------|--------------------------|
108-
| `Agent` | In-memory or Persistent | Ephemeral | Embedded |
109-
| `Durable Agent` | Persistent | Durable | PubSub / HTTP / Embedded |
111+
| Agent Type | Memory Type | Execution | Interaction Mode | Status |
112+
|-----------------|-------------------------|-----------|--------------------------|--------|
113+
| `Agent` | In-memory or Persistent | Ephemeral | Embedded | **Deprecated** (v1.0.0-rc.1) |
114+
| `DurableAgent` | Persistent | Durable | PubSub / HTTP / Embedded | Recommended |
110115

111116

112117
- Regular `Agent`: Interaction is synchronous—you send conversational prompts and receive responses immediately. The conversation can be stored in memory or persisted, but the execution is ephemeral and does not survive restarts.
@@ -180,6 +185,28 @@ Each tool has a descriptive docstring that helps the LLM understand when to use
180185

181186
This is supported directly through LLM parametric knowledge and enhanced by [Function Calling](https://platform.openai.com/docs/guides/function-calling), ensuring tools are invoked efficiently and accurately.
182187

188+
#### Tool Execution Modes
189+
190+
When an LLM returns multiple tool calls in a single turn, `DurableAgent` can execute them in two modes, configured via `AgentExecutionConfig.tool_execution_mode`:
191+
192+
| Mode | Enum Value | Behavior |
193+
|------|-----------|----------|
194+
| **Parallel** (default) | `ToolExecutionMode.PARALLEL` | All tool calls from a single LLM turn are dispatched and awaited concurrently. Best latency when tools are independent. |
195+
| **Sequential** | `ToolExecutionMode.SEQUENTIAL` | Tool calls are executed one-by-one in the order returned by the LLM. Use this when tools have side-effects that depend on results of earlier calls in the same turn. |
196+
197+
```python
198+
from dapr_agents.agents.configs import AgentExecutionConfig, ToolExecutionMode
199+
200+
travel_planner = DurableAgent(
201+
name="TravelBuddy",
202+
...
203+
execution=AgentExecutionConfig(
204+
max_iterations=10,
205+
tool_execution_mode=ToolExecutionMode.SEQUENTIAL,
206+
),
207+
)
208+
```
209+
183210

184211
### MCP Support
185212
Dapr Agents includes built-in support for the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/), enabling agents to dynamically discover and invoke external tools through a standardized interface. Using the provided MCPClient, agents can connect to MCP servers via three transport options: stdio for local development, sse for remote or distributed environments, and via streamable HTTP transport.
@@ -247,6 +274,70 @@ travel_planner = DurableAgent(
247274
| `ConversationVectorMemory` | Vector Store || Semantic | RAG/AI Apps |
248275
| `ConversationDaprStateMemory` | Dapr State Store || Query | Production |
249276

277+
`ConversationVectorMemory` can be backed by any of the supported vector store implementations:
278+
279+
| Vector Store | Class | Backend | Notes |
280+
|---|---|---|---|
281+
| Chroma | `ChromaVectorStore` | ChromaDB | In-memory or persistent; no extra infrastructure |
282+
| PostgreSQL | `PostgresVectorStore` | pgvector extension | Requires PostgreSQL with `pgvector` |
283+
| Redis | `RedisVectorStore` | Redis Stack / Redis with Search | Requires `redisvl` |
284+
285+
```python
286+
from dapr_agents.storage.vectorstores import RedisVectorStore
287+
from dapr_agents.document.embedder.openai import OpenAIEmbedder
288+
from dapr_agents.memory import ConversationVectorMemory
289+
290+
vector_store = RedisVectorStore(
291+
url="redis://localhost:6379",
292+
index_name="my_agent",
293+
embedding_function=OpenAIEmbedder(),
294+
embedding_dimensions=1536,
295+
)
296+
297+
memory = ConversationVectorMemory(
298+
vector_store=vector_store,
299+
distance_metric="cosine",
300+
)
301+
```
302+
303+
304+
### Agents as Tools
305+
306+
Dapr Agents supports invoking other agents - whether Dapr Agents or 3rd party agent frameworks - as tools within a `DurableAgent` reasoning loop. This lets a parent agent delegate sub-tasks to specialized child agents and compose multi-agent systems without using a pub/sub message broker.
307+
308+
Agents registered in the same registry are available to use as tools automatically. This includes invoking 3rd party framework agents. Alternatively, use `agent_to_tool` from `dapr_agents.tool.workflow` for explicit wiring, cross-app routing, or invoking agents from other frameworks:
309+
310+
```python
311+
from dapr_agents.tool.workflow import agent_to_tool
312+
313+
# Invoke a separate agent as a tool call
314+
aragorn_tool = agent_to_tool(
315+
"aragorn",
316+
description="Military Strategy. Goal: Lead the forces of Gondor.",
317+
target_app_id="aragorn-app",
318+
)
319+
# Use an agent as a tool within a DurableAgent
320+
frodo = DurableAgent(
321+
name="frodo",
322+
role="Ring Bearer",
323+
goal="Carry the One Ring to Mordor",
324+
tools=[aragorn_tool],
325+
...
326+
)
327+
```
328+
329+
When the LLM calls one of these tools, Dapr Agents schedules the target agent's workflow as a `DurableAgent` (child workflow) and returns the result—handling cross-app routing and result marshalling transparently.
330+
331+
| Parameter | Description |
332+
|---|---|
333+
| `agent_name` | Name of the target agent (used to derive the tool name and workflow ID) |
334+
| `description` | Human-readable description shown to the parent LLM in the tool schema |
335+
| `target_app_id` | Dapr app-id for cross-app routing; `None` for in-process invocation |
336+
| `framework` | Framework name for non-Dapr-Agents targets (e.g. `"openai"`, `"langgraph"`) |
337+
| `workflow_name` | Explicit Dapr workflow name; takes precedence over `framework` |
338+
339+
See the [Agents as Tools example](https://github.com/dapr/dapr-agents/tree/main/examples/08-agents-as-tools) for a complete working implementation.
340+
250341

251342
### Agent Runner
252343

0 commit comments

Comments
 (0)