Skip to content

feat: move from mozilla any-agent to langchain deepagents#44

Merged
barredterra merged 7 commits into
developfrom
deepagents
Jul 13, 2026
Merged

feat: move from mozilla any-agent to langchain deepagents#44
barredterra merged 7 commits into
developfrom
deepagents

Conversation

@barredterra

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The migration is architecturally sound and well-tested, but the extract_document_data tool in toolset.py will crash at runtime whenever document extraction is triggered.

LangGraph's sync invoke() runs async graphs via an internal event loop. A tool called from inside that loop cannot call asyncio.run() without raising RuntimeError: This event loop is already running. The extract_document_data tool in toolset.py does exactly this (line 511), so every model-initiated PDF/image extraction will fail. All other changed paths are clean.

ask_alyf/ask_alyf/toolset.py — the extract_document_data method needs to run tools.extract_document_data in a worker thread rather than calling asyncio.run() directly.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant API as api.py (process_message_job)
    participant Runner as ask_alyfAgentRunner
    participant Graph as Deep Agents Graph (LangGraph)
    participant Toolset as ask_alyfToolset
    participant SubAgent as source-code-analyzer / document-planner
    participant VFS as CompositeBackend (VFS)

    User->>API: send_message(message, mode)
    API->>API: enqueue background job
    API-->>User: "{conversation, user_message_id}"

    API->>Runner: run_message(conversation_name, message, mode, history)
    Runner->>Runner: _build_input_messages() convert history to LangChain messages
    Runner->>Graph: "agent.invoke({messages})"
    Graph->>Toolset: tool call (e.g. get_list, get_meta, insert...)
    Toolset-->>Graph: tool result
    Graph->>SubAgent: task(source-code-analyzer / document-planner)
    SubAgent->>VFS: ls / read_file / glob / grep via /source/ mount
    VFS-->>SubAgent: file content / matches
    SubAgent-->>Graph: SourceCodeAnalysisResult / DocumentPlannerResult
    Graph-->>Runner: "{messages AIMessage}"
    Runner-->>API: "{response, pending_operations, document_extractions}"
    API->>API: save messages, publish realtime chunks
    API-->>User: ask_alyf_response_complete
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant API as api.py (process_message_job)
    participant Runner as ask_alyfAgentRunner
    participant Graph as Deep Agents Graph (LangGraph)
    participant Toolset as ask_alyfToolset
    participant SubAgent as source-code-analyzer / document-planner
    participant VFS as CompositeBackend (VFS)

    User->>API: send_message(message, mode)
    API->>API: enqueue background job
    API-->>User: "{conversation, user_message_id}"

    API->>Runner: run_message(conversation_name, message, mode, history)
    Runner->>Runner: _build_input_messages() convert history to LangChain messages
    Runner->>Graph: "agent.invoke({messages})"
    Graph->>Toolset: tool call (e.g. get_list, get_meta, insert...)
    Toolset-->>Graph: tool result
    Graph->>SubAgent: task(source-code-analyzer / document-planner)
    SubAgent->>VFS: ls / read_file / glob / grep via /source/ mount
    VFS-->>SubAgent: file content / matches
    SubAgent-->>Graph: SourceCodeAnalysisResult / DocumentPlannerResult
    Graph-->>Runner: "{messages AIMessage}"
    Runner-->>API: "{response, pending_operations, document_extractions}"
    API->>API: save messages, publish realtime chunks
    API-->>User: ask_alyf_response_complete
Loading

Fix All in Cursor

Reviews (3): Last reviewed commit: "fix: change extract_document_data from a..." | Re-trigger Greptile

Comment thread ask_alyf/ask_alyf/deep_agent_backend.py Outdated
Comment thread ask_alyf/ask_alyf/deep_agent_backend.py Outdated
Comment thread ask_alyf/ask_alyf/field_agent.py
Comment thread ask_alyf/ask_alyf/toolset.py
@barredterra

Copy link
Copy Markdown
Member Author

@Mergifyio backport version-16 version-15

@mergify

mergify Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

backport version-16 version-15

✅ Backports have been created

Details

Cherry-pick of e7a2dbd has failed:

On branch mergify/bp/version-15/pr-44
Your branch is up to date with 'origin/version-15'.

You are currently cherry-picking commit e7a2dbd.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   README.md
	modified:   ask_alyf/ask_alyf/agent.py
	modified:   ask_alyf/ask_alyf/api.py
	new file:   ask_alyf/ask_alyf/deep_agent_backend.py
	modified:   ask_alyf/ask_alyf/doctype/ask_alyf_conversation/test_ask_alyf_conversation.py
	modified:   ask_alyf/ask_alyf/field_agent.py
	new file:   ask_alyf/ask_alyf/history.py
	new file:   ask_alyf/ask_alyf/subagents.py
	new file:   ask_alyf/ask_alyf/test_deep_agent_backend.py
	new file:   ask_alyf/ask_alyf/toolset.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   ask_alyf/ask_alyf/test_code_tools.py
	both modified:   ask_alyf/ask_alyf/test_field_agent.py
	both modified:   pyproject.toml

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@barredterra
barredterra merged commit e7a2dbd into develop Jul 13, 2026
5 checks passed
@barredterra
barredterra deleted the deepagents branch July 13, 2026 01:48
barredterra added a commit that referenced this pull request Jul 13, 2026
…) (#49)

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
barredterra added a commit that referenced this pull request Jul 13, 2026
…) (#50)

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

1 participant