Skip to content

Commit a9ce56c

Browse files
committed
Revert "Merge pull request #237 from sicoyle/simplify-agent-creation-part-one"
This reverts commit e99a88d, reversing changes made to 83f291e.
1 parent e99a88d commit a9ce56c

File tree

65 files changed

+1549
-1853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1549
-1853
lines changed

dapr_agents/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from dapr_agents.agents.agent import Agent
22
from dapr_agents.agents.durableagent import DurableAgent
3-
from dapr_agents.agents.memory_store import MemoryStore
43
from dapr_agents.executors import DockerCodeExecutor, LocalCodeExecutor
54
from dapr_agents.llm.dapr import DaprChatClient
65
from dapr_agents.llm.elevenlabs import ElevenLabsSpeechClient
@@ -23,7 +22,6 @@
2322
__all__ = [
2423
"Agent",
2524
"DurableAgent",
26-
"MemoryStore",
2725
"DockerCodeExecutor",
2826
"LocalCodeExecutor",
2927
"ElevenLabsSpeechClient",

dapr_agents/agents/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from .agent.agent import Agent
22
from .base import AgentBase
33
from .durableagent.agent import DurableAgent
4-
from .memory_store import MemoryStore
54

6-
__all__ = ["AgentBase", "Agent", "DurableAgent", "MemoryStore"]
5+
__all__ = ["AgentBase", "Agent", "DurableAgent"]

dapr_agents/agents/agent/agent.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ class Agent(AgentBase):
2121
It integrates tools and processes them based on user inputs and task orchestration.
2222
"""
2323

24-
def get_chat_history(self, task: Optional[str] = None) -> List[Dict[str, Any]]:
25-
"""
26-
Retrieves the chat history as a list of dictionaries.
27-
28-
Args:
29-
task (Optional[str]): The task or query provided by the user.
30-
31-
Returns:
32-
List[Dict[str, Any]]: The chat history as dictionaries.
33-
"""
34-
return self.memory_store.get_messages()
35-
3624
async def run(self, input_data: Optional[Union[str, Dict[str, Any]]] = None) -> Any:
3725
"""
3826
Runs the agent with the given input, supporting graceful shutdown.
@@ -81,15 +69,15 @@ async def _run_agent(
8169
) -> Any:
8270
"""
8371
Internal method for running the agent logic.
84-
Formats messages, updates conversation history, and drives the conversation loop.
72+
Formats messages, updates memory, and drives the conversation loop.
8573
8674
Args:
8775
input_data (Optional[Union[str, Dict[str, Any]]]): Input for the agent, can be a string or dict.
8876
Returns:
8977
Any: The result of the agent's conversation loop.
9078
"""
9179
logger.debug(
92-
f"Agent run started with input: {input_data if input_data else 'Using session conversation context'}"
80+
f"Agent run started with input: {input_data if input_data else 'Using memory context'}"
9381
)
9482

9583
# Construct messages using only input_data; chat history handled internally
@@ -103,7 +91,7 @@ async def _run_agent(
10391
if input_data and user_message_copy:
10492
# Add the new user message to memory only if input_data is provided and user message exists
10593
user_msg = UserMessage(content=user_message_copy.get("content", ""))
106-
self.memory_store.add_message(user_msg)
94+
self.memory.add_message(user_msg)
10795

10896
# Always print the last user message for context, even if no input_data is provided
10997
if user_message_copy is not None:
@@ -172,8 +160,8 @@ async def run_and_record(tool_call: ToolCall) -> ToolMessage:
172160
)
173161
# Print the tool message for visibility
174162
self.text_formatter.print_message(tool_message)
175-
# Add tool message to storage
176-
self.memory_store.add_message(tool_message)
163+
# Add tool message to memory
164+
self.memory.add_message(tool_message)
177165
# Append tool message to the persistent audit log
178166
tool_execution_record = ToolExecutionRecord(
179167
tool_call_id=tool_id,
@@ -227,7 +215,7 @@ async def conversation(self, messages: List[Dict[str, Any]]) -> Any:
227215
else:
228216
assistant = response_message
229217
self.text_formatter.print_message(assistant)
230-
self.memory_store.add_message(assistant)
218+
self.memory.add_message(assistant)
231219

232220
# Handle tool calls response
233221
if assistant is not None and assistant.has_tool_calls():

0 commit comments

Comments
 (0)