Merge branch 'main' into cyb3rward0g/clean-update-elevenlabs

This commit is contained in:
Yaron Schneider 2025-07-18 21:14:22 -07:00 committed by GitHub
commit d2deff4b20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 57 additions and 109 deletions

View File

@ -10,7 +10,7 @@ This quickstart provides a hands-on introduction to Dapr Agents through simple e
## Environment Setup ## Environment Setup
### Option 1: Using pip (Traditional) ### Option 1: Using pip (Recommended)
```bash ```bash
# Create a virtual environment # Create a virtual environment
@ -23,14 +23,11 @@ python3.10 -m venv .venv
source .venv/bin/activate source .venv/bin/activate
# Install dependencies # Install dependencies
pip-compile pyproject.toml
pip install -r requirements.txt pip install -r requirements.txt
# For vectorstore functionality (optional)
pip install sentence-transformers chromadb 'posthog<6.0.0'
``` ```
### Option 2: Using uv (Recommended) ### Option 2: Using uv
```bash ```bash
# Create and activate virtual environment # Create and activate virtual environment
@ -39,20 +36,6 @@ source .venv/bin/activate
# Install core dependencies # Install core dependencies
uv pip install -r requirements.txt uv pip install -r requirements.txt
# For vectorstore functionality (optional)
uv add sentence-transformers chromadb 'posthog<6.0.0'
```
### Option 3: Install with extras (uv only)
```bash
# Create and activate virtual environment
uv venv .venv
source .venv/bin/activate
# Install with vectorstore extras
uv pip install -e ".[vectorstore]"
``` ```
## Configuration ## Configuration
@ -243,6 +226,7 @@ if __name__ == "__main__":
load_dotenv() load_dotenv()
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
asyncio.run(main()) asyncio.run(main())
```
### Interacting with the Agent ### Interacting with the Agent
@ -338,16 +322,16 @@ if __name__ == '__main__':
**Prerequisites:** This example requires vectorstore dependencies. Install them using one of these methods: **Prerequisites:** This example requires vectorstore dependencies. Install them using one of these methods:
**Using uv (recommended):** **Using pip (recommended):**
```bash
uv add sentence-transformers chromadb 'posthog<6.0.0'
```
**Using pip:**
```bash ```bash
pip install sentence-transformers chromadb 'posthog<6.0.0' pip install sentence-transformers chromadb 'posthog<6.0.0'
``` ```
**Using uv:**
```bash
uv add sentence-transformers chromadb 'posthog<6.0.0'
```
**Or install with extras (uv only):** **Or install with extras (uv only):**
```bash ```bash
uv pip install -e ".[vectorstore]" uv pip install -e ".[vectorstore]"

View File

@ -1,2 +1,2 @@
-e ../../ # Import the local dapr agents package dapr-agents>=0.6.0
python-dotenv python-dotenv

View File

@ -1,2 +1,2 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv

View File

@ -1,3 +1,3 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv
elevenlabs elevenlabs

View File

@ -1 +1 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0

View File

@ -1,3 +1,3 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv
tiktoken tiktoken

View File

@ -1,3 +1,3 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv
tiktoken tiktoken

View File

@ -236,17 +236,14 @@ dapr run --app-id weatheragent --resources-path ./components -- python weather_a
## Available Agent Types ## Available Agent Types
Dapr Agents provides several agent implementations, each designed for different use cases: Dapr Agents provides two agent implementations, each designed for different use cases:
### 1. Standard Agent (ToolCallAgent) ### 1. Agent
The default agent type, designed for tool execution and straightforward interactions. It receives your input, determines which tools to use, executes them directly, and provides the final answer. The reasoning process is mostly hidden from you, focusing instead on delivering concise responses. The default agent type, designed for tool execution and straightforward interactions. It receives your input, determines which tools to use, executes them directly, and provides the final answer. The reasoning process is mostly hidden from you, focusing instead on delivering concise responses.
### 2. ReActAgent ### 2. DurableAgent
Implements the Reasoning-Action framework for more complex problem-solving with explicit thought processes. The DurableAgent class is a workflow-based agent that extends the standard Agent with Dapr Workflows for long-running, fault-tolerant, and durable execution. It provides persistent state management, automatic retry mechanisms, and deterministic execution across failures. We will see this agent in the next example.
When you interact with it, you'll see explicit "Thought", "Action", and "Observation" steps as it works through your request, providing transparency into how it reaches conclusions.
### 3. OpenAPIReActAgent
There is one more agent that we didn't run in this quickstart. OpenAPIReActAgent specialized agent for working with OpenAPI specifications and API integrations. When you ask about working with an API, it will methodically identify relevant endpoints, construct proper requests with parameters, handle authentication, and execute API calls on your behalf.
```python ```python
from dapr_agents import Agent from dapr_agents import Agent

View File

@ -1,2 +1,2 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv

View File

@ -1,2 +1,2 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv

View File

@ -1,40 +0,0 @@
from dapr_agents.workflow import WorkflowApp, workflow, task
from dapr.ext.workflow import DaprWorkflowContext
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Define Workflow logic
@workflow(name="task_chain_workflow")
def task_chain_workflow(ctx: DaprWorkflowContext):
character = yield ctx.call_activity(get_character)
print(f"Character: {character}")
line = yield ctx.call_activity(get_line, input={"character": character})
print(f"Line: {line}")
return line
@task(
description="""
Pick a random character from The Lord of the Rings\n
and respond with the character's name only
"""
)
def get_character() -> str:
pass
@task(
description="What is a famous line by {character}",
)
def get_line(character: str) -> str:
pass
if __name__ == "__main__":
wfapp = WorkflowApp()
results = wfapp.run_and_monitor_workflow_sync(task_chain_workflow)
print(f"Results: {results}")

View File

@ -1,4 +1,4 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv
requests requests
chainlit chainlit

View File

@ -1,4 +1,4 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv
mcp mcp
starlette starlette

View File

@ -19,29 +19,33 @@ async def main():
args=["tools.py"], # Run tools.py directly args=["tools.py"], # Run tools.py directly
) )
# Get available tools from the MCP instance try:
tools = client.get_all_tools() tools = client.get_all_tools()
print("🔧 Available tools:", [t.name for t in tools]) print("🔧 Available tools:", [t.name for t in tools])
# Create the Weather Agent using MCP tools # Create the Weather Agent using MCP tools
weather_agent = Agent( weather_agent = Agent(
name="Stevie", name="Stevie",
role="Weather Assistant", role="Weather Assistant",
goal="Help humans get weather and location info using MCP tools.", goal="Help humans get weather and location info using MCP tools.",
instructions=[ instructions=[
"Respond clearly and helpfully to weather-related questions.", "Respond clearly and helpfully to weather-related questions.",
"Use tools when appropriate to fetch or simulate weather data.", "Use tools when appropriate to fetch or simulate weather data.",
"You may sometimes jump after answering the weather question.", "You may sometimes jump after answering the weather question.",
], ],
tools=tools, tools=tools,
) )
# Run a sample query # Run a sample query
result = await weather_agent.run("What is the weather in New York?") result = await weather_agent.run("What is the weather in New York?")
print(result) print(result)
# Clean up resources finally:
await client.close() try:
await client.close()
except RuntimeError as e:
if "Attempted to exit cancel scope" not in str(e):
raise
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,3 +1,3 @@
dapr-agents>=0.5.0 dapr-agents>=0.6.0
python-dotenv python-dotenv
mcp mcp

View File

@ -91,13 +91,16 @@ docker run --rm --name sampledb \
Install Postgres: Install Postgres:
```bash ```bash
# Install and start PostgreSQL
brew install postgresql brew install postgresql
brew services start postgresql brew services start postgresql
psql postgres # Create user and database (safe to re-run)
> CREATE USER admin WITH PASSWORD 'mypassword'; psql postgres <<EOF
> CREATE DATABASE userdb CREATE USER admin WITH PASSWORD 'mypassword';
> GRANT ALL PRIVILEGES ON DATABASE userdb TO admin; CREATE DATABASE userdb OWNER admin;
GRANT ALL PRIVILEGES ON DATABASE userdb TO admin;
EOF
``` ```
Next, create the users table and seed data: Next, create the users table and seed data:

View File

@ -1,4 +1,4 @@
dapr-agents>=0.5.1 dapr-agents>=0.6.0
python-dotenv python-dotenv
chainlit chainlit
psycopg psycopg