Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dapr_agents/workflow/runners/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ async def _get_status(instance_id: str) -> dict:
)
logger.info("Mounted default workflow status endpoint at %s", status_path)

def shutdown(self, agent: Optional[AgentComponents]) -> None:
def shutdown(self, agent: Optional[AgentComponents] = None) -> None:
"""
Unwire subscriptions and close owned clients.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
from pathlib import Path

from dapr_agents.llm import DaprChatClient

Expand All @@ -21,7 +22,7 @@ async def main() -> None:
memory=AgentMemoryConfig(
store=ConversationDaprStateMemory(
store_name="conversation-statestore",
session_id="03-agent-with-memory",
session_id=Path(__file__).stem,
)
),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from dapr_agents.llm import DaprChatClient

from dapr_agents import DurableAgent
Expand All @@ -21,7 +23,7 @@ def main() -> None:
memory=AgentMemoryConfig(
store=ConversationDaprStateMemory(
store_name="conversation-statestore",
session_id="04-durable-agent-http",
session_id=Path(__file__).stem,
)
),
# This is where the execution state is stored
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
from pathlib import Path

from dapr_agents.llm import DaprChatClient

Expand All @@ -16,7 +17,7 @@
from function_tools import slow_weather_func


def main() -> None:
async def main() -> None:
weather_agent = DurableAgent(
name="WeatherAgent",
role="Weather Assistant",
Expand All @@ -28,7 +29,7 @@ def main() -> None:
memory=AgentMemoryConfig(
store=ConversationDaprStateMemory(
store_name="conversation-statestore",
session_id="05-durable-agent-sub",
session_id=Path(__file__).stem,
)
),
# This is where the execution state is stored
Expand All @@ -50,12 +51,10 @@ def main() -> None:
runner = AgentRunner()
try:
runner.subscribe(weather_agent)
await wait_for_shutdown()
finally:
runner.shutdown()


if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\nInterrupted by user. Exiting gracefully...")
asyncio.run(main())
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
import time

import dapr.ext.workflow as wf
Expand Down Expand Up @@ -46,7 +47,7 @@ def get_customer_info(customer_name: str) -> str:
memory=AgentMemoryConfig(
store=ConversationDaprStateMemory(
store_name="conversation-statestore",
session_id="04-support-triage",
session_id=f"{Path(__file__).stem}-triage",
)
),
)
Expand All @@ -62,7 +63,7 @@ def get_customer_info(customer_name: str) -> str:
memory=AgentMemoryConfig(
store=ConversationDaprStateMemory(
store_name="conversation-statestore",
session_id="04-support-expert",
session_id=f"{Path(__file__).stem}-expert",
)
),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import logging
from pathlib import Path

from dapr_agents.llm import DaprChatClient

Expand Down Expand Up @@ -28,7 +29,7 @@ async def main() -> None:
memory=AgentMemoryConfig(
store=ConversationDaprStateMemory(
store_name="conversation-statestore",
session_id="08-durable-agent-trace",
session_id=Path(__file__).stem,
)
),
state=AgentStateConfig(
Expand Down
2 changes: 1 addition & 1 deletion quickstarts/01-dapr-agents-fundamentals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ metadata:
value: "{{OPENAI_API_KEY}}"
```

Replace `OPENAI_API_KEY` with your actual OpenAI API key.
Replace `OPENAI_API_KEY` with your actual OpenAI API key. If you are using a different provider, make sure that you keep the name of the component as `llm-provider`.

---

Expand Down