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
3 changes: 2 additions & 1 deletion tasks/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
from tasks.redis_memory import RedisMemory
from tasks.mongo_persistence import MongoPersistence
from tc_temporal_backend.schema.hivemind import HivemindQueryPayload
from tasks.schema import AgentQueryPayload


@activity.defn
async def run_hivemind_agent_activity(
payload: HivemindQueryPayload,
payload: AgentQueryPayload,
) -> str | None:
Comment on lines +18 to 19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Activity accepts AgentQueryPayload but workflow passes HivemindQueryPayload — type contract broken

run_hivemind_agent_activity now expects AgentQueryPayload, yet the workflow below still calls it with a HivemindQueryPayload instance (see lines 219-224). At runtime this “works” thanks to duck typing, but:
• type checkers will flag an error
• field sets can silently diverge, causing subtle bugs

Align both sides to the same model.

-    async def run(self, payload: HivemindQueryPayload) -> str | None:
+    async def run(self, payload: AgentQueryPayload) -> str | None:

and remove the stale HivemindQueryPayload import if no longer needed.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
payload: AgentQueryPayload,
) -> str | None:
# tasks/agent.py
# Remove this import if HivemindQueryPayload is no longer used elsewhere
-from your.payloads.module import HivemindQueryPayload
from your.payloads.module import AgentQueryPayload
class HivemindAgentWorkflow:
- async def run(self, payload: HivemindQueryPayload) -> str | None:
+ async def run(self, payload: AgentQueryPayload) -> str | None:
...
🤖 Prompt for AI Agents
In tasks/agent.py around lines 18-19 and also lines 219-224, the function
run_hivemind_agent_activity is declared to accept an AgentQueryPayload but is
called with a HivemindQueryPayload, causing a type mismatch. To fix this, update
the workflow code to pass an AgentQueryPayload instance instead of
HivemindQueryPayload, ensuring both sides use the same payload type. Also,
remove the import of HivemindQueryPayload if it is no longer used anywhere in
the file.

"""
Activity that instantiates and runs the Crew.ai Flow (AgenticHivemindFlow).
Expand Down
19 changes: 19 additions & 0 deletions tasks/schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pydantic import BaseModel, Field


class AgentQueryPayload(BaseModel):
community_id: str = Field(
..., description="the community id data to use for answering"
)
query: str = Field(..., description="the user query to ask llm")
enable_answer_skipping: bool = Field(
False,
description=(
"skip answering questions with non-relevant retrieved information"
"having this, it could provide `None` for response and source_nodes"
),
)
chat_id: str = Field(
default="",
description="the chat id to use for answering",
)