Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read history while using playground #1919

Open
rk-yen opened this issue Jan 29, 2025 · 2 comments
Open

Unable to read history while using playground #1919

rk-yen opened this issue Jan 29, 2025 · 2 comments

Comments

@rk-yen
Copy link

rk-yen commented Jan 29, 2025

Using version 2.7.8.

The following is how my Playground is setup.

duckDb = DuckDbTools(db_path=("/tmp/foo.db"))
agent = PythonAgent(
    name="My Agent",
    add_datetime_to_instructions=True,
    add_history_to_messages=True,
    num_history_responses=3,
    base_dir=tmp,
    tools=[
      duckDb
    ],
    description="...",
    instructions=[
      "Use tables to display data",
      "..."
    ],
    pip_install=True,
    show_tool_calls=False,
    markdown=True,
    debug_mode=True
)

app = Playground(agents=[agent]).get_app()
if __name__ == "__main__":
    serve_playground_app("my_agent:app", reload=True)

When invoking two consecutive messages, I see the following logs:

DEBUG    **************** METRICS END ******************                                                                             
DEBUG    ---------- OpenAI Async Response End ----------                                                                             
DEBUG    Added 2 Messages to AgentMemory                                                                                             
DEBUG    Added AgentRun to AgentMemory                                                                                               
DEBUG    --**-- Logging Agent Run (Async)                                                                                            
DEBUG    *********** Async Agent Run End: 05c52ccf-67da-4587-a07e-34a5d7be91fe ***********                                           
DEBUG    AgentRunRequest: <my question> d512153f-5407-4c6f-bd20-0b2f4fc83d11 rk           
         aa21a13c-77ec-427a-b47e-b75f43ce7f6a                                                                                        
DEBUG    Continuing session: d512153f-5407-4c6f-bd20-0b2f4fc83d11                                                                    
WARNING  Failed to deepcopy field: tools - cannot pickle 'PyCapsule' object                                                          
DEBUG    *********** Agent ID: 48cd3094-4beb-4cad-b27b-f0f651a29c9a ***********                                                      
DEBUG    *********** Session ID: d512153f-5407-4c6f-bd20-0b2f4fc83d11 ***********                                                    
DEBUG    Debug logs enabled                                                                                                          
DEBUG    Created new Agent: agent_id: 48cd3094-4beb-4cad-b27b-f0f651a29c9a | session_id: d512153f-5407-4c6f-bd20-0b2f4fc83d11        
INFO:     127.0.0.1:55588 - "POST /v1/playground/agent/run HTTP/1.1" 200 OK
DEBUG    *********** Async Agent Run Start: 09f69f78-e07e-45e2-830e-ea247b1e153c ***********                                         
DEBUG    Function show_tables from duckdb_tools added to model.                                                                      
DEBUG    Function describe_table from duckdb_tools added to model.                                                                   
DEBUG    Function run_query from duckdb_tools added to model.                                                                        
DEBUG    Function create_table_from_path from duckdb_tools added to model.                                                           
DEBUG    Function summarize_table from duckdb_tools added to model.                                                                  
DEBUG    Function save_to_file_and_run from python_tools added to model.                                                             
DEBUG    Function pip_install_package from python_tools added to model.                                                              
DEBUG    Function get_tool_call_history added to model.                                                                              
DEBUG    Building the system prompt for the PythonAgent.                                                                             
DEBUG    Getting messages from last 3 runs                                                                                           
DEBUG    Messages from last 3 runs: 0                                                                                                
DEBUG    ---------- OpenAI Async Response Start ----------   

In the logs above, I see:

DEBUG    Added 2 Messages to AgentMemory
DEBUG    Added AgentRun to AgentMemory

for the first run.
But, for the second run, I see:

DEBUG    Getting messages from last 3 runs
DEBUG    Messages from last 3 runs: 0

Is this a known issue?

@ysolanky
Copy link
Contributor

Hello @rk-yen No, this is not a known issue, starting today, we have rebranded to Agno. The new library includes a number of improvements. Can you please migrate your code to Agno and then try again. Thank you!

@rk-yen
Copy link
Author

rk-yen commented Jan 31, 2025

@ysolanky ... I migrated to agno. And, see similar behavior.

DEBUG    ---------- OpenAI Async Response End ----------                                                                     
DEBUG    ---------- OpenAI Async Response End ----------                                                                     
DEBUG    Added 12 Messages to AgentMemory                                                                                    
DEBUG    Added AgentRun to AgentMemory                                                                                       
DEBUG    Could not create agent event: first argument must be callable or None                                               
DEBUG    *********** Agent Run End: 3add6a00-55af-4c5b-96b5-5d12d2506380 ***********  
...
...
...
DEBUG    *********** Agent ID: aa10d95d-fcb8-4408-bd58-d97bab80b3f5 ***********                                              
DEBUG    *********** Session ID: c99a137c-a1de-4b0f-bf94-25151704727e ***********                                            
DEBUG    *********** Async Agent Run Start: 6d4d634a-3259-42d9-8178-8bbdb188537a *********** 
DEBUG    Getting messages from last 3 runs                                                                                   
DEBUG    Messages from last 3 runs: 0                                                                                        
DEBUG    ---------- OpenAI Async Response Start ----------                                                                   
DEBUG    ============== developer ==============  

The code looks like the following:

from pathlib import Path
import tempfile

from agno.agent import Agent
from agno.tools.python import PythonTools
from agno.playground import Playground, serve_playground_app
from dotenv import load_dotenv

load_dotenv()

with tempfile.TemporaryDirectory() as f:
    tmp = Path(f)


my_agent = Agent(
    name="MyTest",
    add_datetime_to_instructions=True,
    add_history_to_messages=True,
    num_history_responses=3,
    tools=[
      PythonTools(base_dir=tmp, pip_install=True, run_code=True)
    ],
    description="""
      You are an expert in Python and can accomplish any task that is asked of you.
    """,
    show_tool_calls=False,
    markdown=True,
    debug_mode=True
)

app = Playground(agents=[my_agent]).get_app()
if __name__ == "__main__":
    serve_playground_app("my_agent:app", reload=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants