google / google/adk-python

Migration from SequentialAgent to Workflow with AgentTools: Context is lost

Đang mở
#5,780 13 bình luận 0 reaction 2 người được giao Được @DeanChensj nhận Xem trên GitHub
needs review v2 workflow
Ngôn ngữ chính
Python
Star
21.5k
Fork
4k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
37

Mô tả

## 🔴 Required Information
*Please ensure all items in this section are completed to allow for efficient
triaging. Requests without complete information may be rejected / deprioritized.
If an item is not applicable to you - please mark it as N/A*

**Describe the Bug:**
I am migrating my SequentialAgent to the new Workflow. Agent 1 has AgentTools.

After migration the Agent calling an AgentTool restarts without context:
START -> Agent1 -> calling Tool "agentTool1" -> Back to Agent1 (but this time the agents starts without any context. It just has its system instructions available).

**Steps to Reproduce:**
Before:
```
sequential_agent = SequentialAgent(
name="Assistant",
description="Sequential agent that orchestrates work and synthesizes final response",
sub_agents=[orchestrator_agent, response_agent],
)
```
Iterating events:
`async for event in sequential_agent.run_async(ctx):`

After:
```
sequential_workflow = Workflow(
name="Assistant",
edges=[("START", orchestrator_agent, response_agent)],
)
```
Iterating events:
`async for event in sequential_workflow.run(ctx=Context(ctx), node_input=ctx.user_content):`

**Expected Behavior:**
Agent1 working on user query, calling agentTool1, returning to Agent1 with full context available (user query, tools calls, tool responses, etc), Agent1 continuing its task

**Observed Behavior:**
Agent1 working on user query, calling agentTool1, returning to Agent1 with no context available, therefore answering something like "Understood. Provide request"

In mlflow it can be seen, the user query is "Handle the requests as specified in the System Instruction.", which is inserted by litellm automatically, if no content parts are available.

**Environment Details:**

- ADK Library Version (pip show google-adk): 2.0.0
- Desktop OS:** macOS
- Python Version (python -V): 3.12.13

**Model Information:**

- Are you using LiteLLM: Yes
- Which model is being used: Mistral Models, but that's irrelevant

---

## 🟡 Optional Information
*Providing this information greatly speeds up the resolution process.*

**Regression:**
It works with sequential agent, it does not with worflow

**Logs:**
n/a

**Screenshots / Video:**
n/a

**Additional Context:**
n/a

**Minimal Reproduction Code:**
n/a

**How often has this issue occurred?:**
- Always (100%)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.