Refactor: slim akd-core — drop search/gap/storm agents and langchain deps#432
Conversation
|
✅ Tests passed 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
muthukumaranR
left a comment
There was a problem hiding this comment.
Approve on the reduction, with some notes:
-
why keep these things?
| Utility |IntentAgent| User intent classification |
|QueryAgent| Query reformulation and refinement |
|FollowUpQueryAgent| Follow-up query generation | -
looking at toml, I feel it’s still a little bloated. google, duckduckgo etc. should we do optional dependency groups / [tagged] installation, where the base is just bare essentials.
- example groups: [evals, search_tools, etc]
- is the intent to add AKDSerializer / langgraph to go towards unified AKD [core + backend] and towards the SDK?
Good call. Let me trim down the toml but need to validate as well.
Kind of. Since we no longer have much langchain/langgraph dependency, I think it's best for compatibility to maintain an extra deps for it and lazy load for time being. The |
|
✅ Tests passed 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
✅ Tests passed 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
Continuation of the akd-core slim-down (follow-up to #426). Rips out every in-core agent that's either superseded by a future tool+ReAct loop implementation or scoped to live in external packages (
akd_ext, backend). Also retires the langchain dependency tree in favor of LiteLLM — already akd's single LLM client of record forLiteLLMInstructorBaseAgent.~14,900 lines deleted, ~300 added across 86 files. No runtime behavior changes for remaining agents/tools.
Major Changes
DeepLitSearchAgent,ControlledSearchAgent,CodeSearchAgent,QuestionAnsweringAgent,AspectSearchAgent, plus theSearchAgent/LitBaseAgentbase classes and theLitSearchAgent*/SearchAgent*schema family. Alsoakd/agents/search/components/(triage, clarification, instruction_builder, research_synthesis, content_condensation). Search will come back as a thin tool+ReAct loop in a later PR.GapAgent— entireakd/agents/gap_analysis/subpackage and its profilers. Downstream packages (akd_ext) already ship their own gap agent and can register it at runtime viaAgentRegistry.register_agent(...).StormAgent— entireakd/agents/storm/subpackage +akd/configs/storm_config.py. Had zero tests and only one external reference (a gitignored marimo notebook).LitAgentdeprecation shim —akd/agents/litsearch.py. No remaining imports in-tree.AVAILABLE_AGENTScleared inakd/planner/registry.py. The machinery stays intact for runtime registration viaAgentRegistry.register_agent(YourAgent); backends /akd_extpopulate it at startup. JSON caches inakd/mapping/emptied to match.LLMFallbackMapperfromlangchain_openai.ChatOpenAIto LiteLLM —akd/mapping/mappers.pynow useslitellm.acompletion(...)directly. Completes the pre-existing# TODO: implement liteLLM interface and replace thiscomment.AKDSerializer's langgraph dependency via lazy import —AKDSerializernow extendsJsonPlusSerializeronly when langgraph is importable; the_convert_pydantic_to_dicthelper (the only part the mapping system uses) works with no langgraph installed. Checkpoint serde role (dumps/loads/dumps_typed/loads_typed) is preserved for backends that install theserializerextra.pyproject.tomlno longer pullslangchain-community,langchain-core,langchain-google-community,langchain-huggingface,langchain-openai, orlanggraph. A newserializeroptional extra shipslanggraph==1.0.3for backends that useAKDSerializer()as a checkpoint serde.uv.lockregenerated — ~20 transitive langchain-* packages gone.Minor Changes
ExtractionSchema,SingleEstimation,ResearchData, and theLitSearchResult = SearchResultItemalias dropped fromakd/structures.pyand its re-exports inakd/__init__.py. Nothing in-tree still referenced them after theExtractionAgenthad been removed in an earlier PR.PaperDataItemkept (used by the Semantic Scholar tool).scripts/demo_deep_search.py,scripts/test_guardrails_code_search.py,scripts/run_lit_agent.py, plus all ofscripts/profilers/(both deep-search and gap-agent profilers, the memray profiler, andPROFILING_README.md).examples/deep_search_test.pyandexamples/code_search_test.pydeleted.tests/agents/search/,tests/agents/gap_analysis/,tests/code_search_tool_test.py, and four planner test files (test_registry.py,test_workflow_builder.py,test_field_mapping.py,test_llm_planner.py) whose fixtures were hard-coded to the now-deleteddeep_search/code_search/gap_analysisagent IDs.tests/planner/test_workflow_format.pykept (tests the workflow-format validator with generic placeholders).tests/mapping/test_mappers.pypruned of the 4 cases coupled to the removedLitSearchAgent*schemas.create_lit_agent()dropped fromakd/agents/factory.py.akd/tools/search/code_search.pydeleted (only consumer was the agent being removed);akd/tools/search/composite.pydocstring example rewritten to use remaining tools.AKDSerializerraises a clearRuntimeErrorpointing atpip install akd[serializer]ifdumps/dumps_typedis called without langgraph installed.docs/node-template.mddeleted (entire file documented aNodeTemplateclass that never shipped); langgraph-specific code block removed fromdocs/design_philosophy.md;docs/specs/STREAMING.mdsamples retargeted fromDeepLitSearchAgentto a genericMyResearchAgentplaceholder;akd/mapping/README.mdandakd/planner/README.mdretargeted to generic agent IDs.serializer/ml/dev/localextras, plus install examples for each.CLAUDE.mdagents/configs tree trimmed to the remaining modules;README.mdagents table pruned to the utility agents that remain (IntentAgent, QueryAgent, FollowUpQueryAgent, RelevancyAgent, MultiRubricRelevancyAgent, BaseAgent, LiteLLMInstructorBaseAgent) plus a note on runtime registration; speculative "Conflict Agent" / "Full Attribution Chain" roadmap items removed.requirements.txt— dropped the 6 langchain/langgraph lines so CI (.github/workflows/*.ymlusespip install -r requirements.txt) stays in sync withpyproject.toml. Broader sync of that file vs pyproject is out of scope.akd/utils.py—PartialModeldocstring example rewritten to stop importing the deletedLitSearchAgentOutputSchema.akd/tools/utils.py— staleto_langchain_structured_tool()line removed fromtool_wrapperdocstring (method never existed).Dead code removed
akd/agents/search/(subpackage) +akd/agents/search/components/+akd/agents/search/aspect_search/akd/agents/gap_analysis/(subpackage)akd/agents/storm/(subpackage) +akd/configs/storm_config.pyakd/agents/litsearch.py(deprecation shim)akd/tools/search/code_search.pyBackend coordination (akd-framework)
akd-frameworkusesAKDSerializeras theserdeforAsyncPostgresSaver(langgraph checkpointer). After this PR lands, backend needs to installakd[serializer](or pinlanggraphitself) soAKDSerializer.dumps/dumps_typed/loads/loads_typedremain wired up. The lazy import makes the class importable either way — only the checkpoint-serde methods require langgraph.Test plan
uv run pytest tests/mapping/— 20 passed after mapper migration; LLM-fallback tests correctly skip without an OpenAI keyuv run python -c "from akd.agents import search"/gap_analysis/storm/litsearchall raiseModuleNotFoundErroruv run python -c "from akd.planner.registry import AgentRegistry; ..."— empty registry, runtimeregister_agent(QueryAgent)worksAKDSerializer._convert_pydantic_to_dict(M(...))works;dumps_typedworks with langgraph installeduv lockregenerates cleanly; langchain-community / -google-community / -huggingface / -openai all removed from lockfileuv run pytestlocally on final branch state (after last push).github/workflows/cicd.yml) green on the branchakd-frameworkinstall bumped toakd[serializer]before this merges or in the same window