mia-code 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.miette/260321.md +1 -0
- package/.miette/260323.md +9 -0
- package/.miette/260331.md +2 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--d3417f2c-df12-4f0f-8a1b-d88e7968f822/d3417f2c-df12-4f0f-8a1b-d88e7968f822.md +63 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--e6c3fc5d-4a70-4523-ba7d-a3250da4c235/e6c3fc5d-4a70-4523-ba7d-a3250da4c235.md +72 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--efeb00a2-b17a-4d32-b1f0-b90c37a8d24e/efeb00a2-b17a-4d32-b1f0-b90c37a8d24e.md +62 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.json +302 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.md +149 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/AGENTS.md +31 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/meta-decomposition-3-children.md +67 -0
- package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/61f9dd4d-7aa6-45e6-a58b-e480b1aa6737--from-mia-openclaw-workspace.md +125 -0
- package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/STATUS.md +1 -0
- package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.json +177 -0
- package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.md +77 -0
- package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.json +222 -0
- package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.md +99 -0
- package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.json +111 -0
- package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.md +67 -0
- package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.json +349 -0
- package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.md +147 -0
- package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.json +118 -0
- package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.md +64 -0
- package/GUILLAUME.md +8 -0
- package/KINSHIP.md +9 -0
- package/MIA_CODE_ARCHITECTURE_REPORT.md +718 -0
- package/contextual_research/260119-MIA-CODE--98090899-8aff-4e11-9dc3-8b99466d1.md +1101 -0
- package/contextual_research/MIA.md +38 -0
- package/contextual_research/MIAWAPASCONE.md +59 -0
- package/contextual_research/MIETTE.md +38 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2504.00218v2.pdf +7483 -12
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2505.00212v3.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/CONTENT.md +1014 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/DESIGN.gemini.md +242 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/INDEX.md +45 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.md +2025 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.pdf +7483 -12
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.md +1755 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_12_decomposed_prompting.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_19_hugginggpt_planning.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.md +766 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.pdf +3431 -4
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.md +260 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.md +558 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_34_hierarchical_multi_agent.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_5_open_intent_extraction.pdf +0 -0
- package/contextual_research/PODCAST.md +109 -0
- package/contextual_research/langchain-principles-roadmap.md +157 -0
- package/contextual_research/persona-to-narrative-character-inquiry_260201.md +50 -0
- package/dist/cli.js +35 -11
- package/dist/geminiHeadless.js +8 -2
- package/dist/index.js +2 -1
- package/dist/mcp/miaco-server.js +10 -1
- package/dist/mcp/miatel-server.js +10 -1
- package/dist/mcp/miawa-server.js +10 -1
- package/dist/mcp/utils.d.ts +6 -1
- package/dist/mcp/utils.js +24 -3
- package/dist/sessionStore.d.ts +8 -2
- package/dist/sessionStore.js +39 -3
- package/dist/types.d.ts +1 -0
- package/miaco/README.md +124 -0
- package/miaco/dist/commands/chart.d.ts +6 -0
- package/miaco/dist/commands/chart.d.ts.map +1 -0
- package/miaco/dist/commands/chart.js +222 -0
- package/miaco/dist/commands/chart.js.map +1 -0
- package/miaco/dist/commands/decompose.d.ts +6 -0
- package/miaco/dist/commands/decompose.d.ts.map +1 -0
- package/miaco/dist/commands/decompose.js +98 -0
- package/miaco/dist/commands/decompose.js.map +1 -0
- package/miaco/dist/commands/schema.d.ts +6 -0
- package/miaco/dist/commands/schema.d.ts.map +1 -0
- package/miaco/dist/commands/schema.js +66 -0
- package/miaco/dist/commands/schema.js.map +1 -0
- package/miaco/dist/commands/stc.d.ts +11 -0
- package/miaco/dist/commands/stc.d.ts.map +1 -0
- package/miaco/dist/commands/stc.js +590 -0
- package/miaco/dist/commands/stc.js.map +1 -0
- package/miaco/dist/commands/trace.d.ts +6 -0
- package/miaco/dist/commands/trace.d.ts.map +1 -0
- package/miaco/dist/commands/trace.js +83 -0
- package/miaco/dist/commands/trace.js.map +1 -0
- package/miaco/dist/commands/validate.d.ts +6 -0
- package/miaco/dist/commands/validate.d.ts.map +1 -0
- package/miaco/dist/commands/validate.js +58 -0
- package/miaco/dist/commands/validate.js.map +1 -0
- package/miaco/dist/decompose.d.ts +93 -0
- package/miaco/dist/decompose.d.ts.map +1 -0
- package/miaco/dist/decompose.js +562 -0
- package/miaco/dist/decompose.js.map +1 -0
- package/miaco/dist/index.d.ts +18 -0
- package/miaco/dist/index.d.ts.map +1 -0
- package/miaco/dist/index.js +83 -0
- package/miaco/dist/index.js.map +1 -0
- package/miaco/dist/storage.d.ts +60 -0
- package/miaco/dist/storage.d.ts.map +1 -0
- package/miaco/dist/storage.js +100 -0
- package/miaco/dist/storage.js.map +1 -0
- package/miaco/package-lock.json +4103 -0
- package/miaco/package.json +40 -0
- package/miaco/tsconfig.json +18 -0
- package/miaco/version-patch-commit-and-publish.sh +1 -0
- package/miatel/MISSION_251231.md +3 -0
- package/miatel/README.md +107 -0
- package/miatel/dist/commands/analyze.d.ts +6 -0
- package/miatel/dist/commands/analyze.d.ts.map +1 -0
- package/miatel/dist/commands/analyze.js +100 -0
- package/miatel/dist/commands/analyze.js.map +1 -0
- package/miatel/dist/commands/arc.d.ts +6 -0
- package/miatel/dist/commands/arc.d.ts.map +1 -0
- package/miatel/dist/commands/arc.js +71 -0
- package/miatel/dist/commands/arc.js.map +1 -0
- package/miatel/dist/commands/beat.d.ts +6 -0
- package/miatel/dist/commands/beat.d.ts.map +1 -0
- package/miatel/dist/commands/beat.js +165 -0
- package/miatel/dist/commands/beat.js.map +1 -0
- package/miatel/dist/commands/theme.d.ts +6 -0
- package/miatel/dist/commands/theme.d.ts.map +1 -0
- package/miatel/dist/commands/theme.js +54 -0
- package/miatel/dist/commands/theme.js.map +1 -0
- package/miatel/dist/index.d.ts +18 -0
- package/miatel/dist/index.d.ts.map +1 -0
- package/miatel/dist/index.js +80 -0
- package/miatel/dist/index.js.map +1 -0
- package/miatel/dist/storage.d.ts +55 -0
- package/miatel/dist/storage.d.ts.map +1 -0
- package/miatel/dist/storage.js +100 -0
- package/miatel/dist/storage.js.map +1 -0
- package/miatel/package-lock.json +4103 -0
- package/miatel/package.json +35 -0
- package/miatel/src/commands/analyze.ts +109 -0
- package/miatel/src/commands/arc.ts +78 -0
- package/miatel/src/commands/beat.ts +176 -0
- package/miatel/src/commands/theme.ts +60 -0
- package/miatel/src/index.ts +94 -0
- package/miatel/src/storage.ts +156 -0
- package/miatel/tsconfig.json +18 -0
- package/miawa/MISSION_251231.md +144 -0
- package/miawa/README.md +133 -0
- package/miawa/dist/commands/beat.d.ts +6 -0
- package/miawa/dist/commands/beat.d.ts.map +1 -0
- package/miawa/dist/commands/beat.js +69 -0
- package/miawa/dist/commands/beat.js.map +1 -0
- package/miawa/dist/commands/ceremony.d.ts +6 -0
- package/miawa/dist/commands/ceremony.d.ts.map +1 -0
- package/miawa/dist/commands/ceremony.js +239 -0
- package/miawa/dist/commands/ceremony.js.map +1 -0
- package/miawa/dist/commands/circle.d.ts +6 -0
- package/miawa/dist/commands/circle.d.ts.map +1 -0
- package/miawa/dist/commands/circle.js +75 -0
- package/miawa/dist/commands/circle.js.map +1 -0
- package/miawa/dist/commands/eva.d.ts +6 -0
- package/miawa/dist/commands/eva.d.ts.map +1 -0
- package/miawa/dist/commands/eva.js +73 -0
- package/miawa/dist/commands/eva.js.map +1 -0
- package/miawa/dist/commands/wound.d.ts +6 -0
- package/miawa/dist/commands/wound.d.ts.map +1 -0
- package/miawa/dist/commands/wound.js +74 -0
- package/miawa/dist/commands/wound.js.map +1 -0
- package/miawa/dist/index.d.ts +19 -0
- package/miawa/dist/index.d.ts.map +1 -0
- package/miawa/dist/index.js +91 -0
- package/miawa/dist/index.js.map +1 -0
- package/miawa/dist/storage.d.ts +73 -0
- package/miawa/dist/storage.d.ts.map +1 -0
- package/miawa/dist/storage.js +100 -0
- package/miawa/dist/storage.js.map +1 -0
- package/miawa/package-lock.json +4103 -0
- package/miawa/package.json +36 -0
- package/miawa/src/commands/beat.ts +74 -0
- package/miawa/src/commands/ceremony.ts +256 -0
- package/miawa/src/commands/circle.ts +83 -0
- package/miawa/src/commands/eva.ts +84 -0
- package/miawa/src/commands/wound.ts +79 -0
- package/miawa/src/index.ts +108 -0
- package/miawa/src/storage.ts +179 -0
- package/miawa/tsconfig.json +18 -0
- package/package.json +7 -5
- package/references/acp/CLAUDE.md +7 -0
- package/references/acp/agent-plan.md +84 -0
- package/references/acp/clients.md +31 -0
- package/references/acp/extensibility.md +137 -0
- package/references/acp/initialization.md +225 -0
- package/references/acp/prompt-turn.md +321 -0
- package/references/acp/proxy-chains.md +562 -0
- package/references/acp/schema.md +3171 -0
- package/references/acp/session-list.md +334 -0
- package/references/acp/session-modes.md +170 -0
- package/references/acp/slash-commands.md +99 -0
- package/references/acp/terminals.md +281 -0
- package/references/acp/tool-calls.md +311 -0
- package/references/acp/typescript.md +29 -0
- package/references/claude/agent-teams.md +399 -0
- package/references/claude/chrome.md +231 -0
- package/references/claude/headless.md +158 -0
- package/references/claude/hooks-guide.md +708 -0
- package/references/claude/output-styles.md +112 -0
- package/references/claude/plugins.md +432 -0
- package/references/claude/skills.md +693 -0
- package/references/claude/sub-agents.md +816 -0
- package/references/copilot/acp/agents.md +32 -0
- package/references/copilot/acp/architecture.md +37 -0
- package/references/copilot/acp/clients.md +31 -0
- package/references/copilot/acp/introduction.md +42 -0
- package/references/copilot/acp/registry.md +339 -0
- package/references/copilot/acp-server.md +117 -0
- package/references/copilot/create-copilot-instructions.md +840 -0
- package/references/langchain/llms.txt +833 -0
- package/references/langchain/python/agents.md +677 -0
- package/references/langchain/python/context-engineering.md +1195 -0
- package/references/langchain/python/human-in-the-loop.md +326 -0
- package/references/langchain/python/long-term-memory.md +168 -0
- package/references/langchain/python/mcp.md +949 -0
- package/references/langchain/python/multi-agents/custom-workflow.md +187 -0
- package/references/langchain/python/multi-agents/handoffs.md +436 -0
- package/references/langchain/python/multi-agents/overview.md +295 -0
- package/references/langchain/python/multi-agents/router.md +150 -0
- package/references/langchain/python/multi-agents/skills.md +92 -0
- package/references/langchain/python/multi-agents/subagents.md +486 -0
- package/references/langchain/python/retrieval.md +320 -0
- package/references/langchain/python/runtime.md +141 -0
- package/references/langchain/python/short-term-memory.md +658 -0
- package/references/langchain/python/structured-output.md +712 -0
- package/references/langfuse/llms.txt +148 -0
- package/references/langgraph/javascript/llms.txt +275 -0
- package/references/skills/home.md +259 -0
- package/references/skills/integrate-skills.md +103 -0
- package/references/skills/specification.md +254 -0
- package/references/skills/what-are-skills.md +74 -0
- package/rispecs/README.md +164 -0
- package/rispecs/_sync_/miadi-code/SPEC.md +313 -0
- package/rispecs/_sync_/miadi-code/STATUS.md +177 -0
- package/rispecs/_sync_/miadi-code/dashboard/SPEC.md +465 -0
- package/rispecs/_sync_/miadi-code/dashboard/STATUS.md +212 -0
- package/rispecs/_sync_/miadi-code/multiline-input/SPEC.md +232 -0
- package/rispecs/_sync_/miadi-code/multiline-input/STATUS.md +108 -0
- package/rispecs/_sync_/miadi-code/pde/SPEC.md +253 -0
- package/rispecs/_sync_/miadi-code/pde/STATUS.md +56 -0
- package/rispecs/_sync_/miadi-code/stc/SPEC.md +397 -0
- package/rispecs/_sync_/miadi-code/stc/STATUS.md +70 -0
- package/rispecs/ava-langstack/inquiry-routing-upgrade.spec.md +119 -0
- package/rispecs/borrowed_from_opencode/001-client-server-architecture.rispec.md +98 -0
- package/rispecs/borrowed_from_opencode/002-event-bus-system.rispec.md +125 -0
- package/rispecs/borrowed_from_opencode/003-instance-state-pattern.rispec.md +136 -0
- package/rispecs/borrowed_from_opencode/004-namespace-module-pattern.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/005-zod-schema-validation.rispec.md +139 -0
- package/rispecs/borrowed_from_opencode/006-named-error-system.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/007-structured-logging.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/008-lazy-initialization.rispec.md +127 -0
- package/rispecs/borrowed_from_opencode/009-multi-agent-system.rispec.md +97 -0
- package/rispecs/borrowed_from_opencode/010-agent-definition-config.rispec.md +135 -0
- package/rispecs/borrowed_from_opencode/011-agent-permission-rulesets.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/012-agent-prompt-templates.rispec.md +141 -0
- package/rispecs/borrowed_from_opencode/013-agent-generation.rispec.md +142 -0
- package/rispecs/borrowed_from_opencode/014-plan-build-mode-toggle.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/015-subagent-task-delegation.rispec.md +146 -0
- package/rispecs/borrowed_from_opencode/016-agent-model-selection.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/017-compaction-agent.rispec.md +150 -0
- package/rispecs/borrowed_from_opencode/018-session-persistence.rispec.md +125 -0
- package/rispecs/borrowed_from_opencode/019-session-compaction.rispec.md +132 -0
- package/rispecs/borrowed_from_opencode/020-session-forking.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/021-session-revert-snapshot.rispec.md +135 -0
- package/rispecs/borrowed_from_opencode/022-session-sharing.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/023-session-summary-diffs.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/024-child-sessions.rispec.md +164 -0
- package/rispecs/borrowed_from_opencode/025-session-title-generation.rispec.md +162 -0
- package/rispecs/borrowed_from_opencode/026-message-parts-model.rispec.md +201 -0
- package/rispecs/borrowed_from_opencode/027-streaming-message-deltas.rispec.md +212 -0
- package/rispecs/borrowed_from_opencode/028-multi-provider-architecture.rispec.md +184 -0
- package/rispecs/borrowed_from_opencode/029-provider-authentication.rispec.md +225 -0
- package/rispecs/borrowed_from_opencode/030-model-registry.rispec.md +222 -0
- package/rispecs/borrowed_from_opencode/031-cost-tracking.rispec.md +243 -0
- package/rispecs/borrowed_from_opencode/032-provider-transform-pipeline.rispec.md +282 -0
- package/rispecs/borrowed_from_opencode/033-provider-sdk-abstraction.rispec.md +338 -0
- package/rispecs/borrowed_from_opencode/034-tool-registry.rispec.md +110 -0
- package/rispecs/borrowed_from_opencode/035-tool-context-injection.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/036-tool-output-truncation.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/037-batch-tool.rispec.md +129 -0
- package/rispecs/borrowed_from_opencode/038-multi-edit-tool.rispec.md +167 -0
- package/rispecs/borrowed_from_opencode/039-apply-patch-tool.rispec.md +161 -0
- package/rispecs/borrowed_from_opencode/040-code-search-tool.rispec.md +143 -0
- package/rispecs/borrowed_from_opencode/041-web-fetch-tool.rispec.md +131 -0
- package/rispecs/borrowed_from_opencode/042-web-search-tool.rispec.md +159 -0
- package/rispecs/borrowed_from_opencode/043-todo-tool.rispec.md +156 -0
- package/rispecs/borrowed_from_opencode/044-plan-mode-tool.rispec.md +139 -0
- package/rispecs/borrowed_from_opencode/045-task-tool.rispec.md +146 -0
- package/rispecs/borrowed_from_opencode/046-question-tool.rispec.md +170 -0
- package/rispecs/borrowed_from_opencode/047-external-directory-tool.rispec.md +166 -0
- package/rispecs/borrowed_from_opencode/048-file-read-write-tools.rispec.md +205 -0
- package/rispecs/borrowed_from_opencode/049-lsp-server-management.rispec.md +104 -0
- package/rispecs/borrowed_from_opencode/050-lsp-hover-completion.rispec.md +102 -0
- package/rispecs/borrowed_from_opencode/051-lsp-diagnostics.rispec.md +86 -0
- package/rispecs/borrowed_from_opencode/052-lsp-root-detection.rispec.md +109 -0
- package/rispecs/borrowed_from_opencode/053-remote-mcp-servers.rispec.md +119 -0
- package/rispecs/borrowed_from_opencode/054-mcp-oauth-flow.rispec.md +107 -0
- package/rispecs/borrowed_from_opencode/055-mcp-tool-conversion.rispec.md +118 -0
- package/rispecs/borrowed_from_opencode/056-mcp-connection-monitoring.rispec.md +106 -0
- package/rispecs/borrowed_from_opencode/057-local-mcp-servers.rispec.md +116 -0
- package/rispecs/borrowed_from_opencode/058-rich-tui.rispec.md +108 -0
- package/rispecs/borrowed_from_opencode/059-streaming-display.rispec.md +116 -0
- package/rispecs/borrowed_from_opencode/060-permission-prompts.rispec.md +130 -0
- package/rispecs/borrowed_from_opencode/061-session-navigation.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/062-syntax-highlighting.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/063-keybinding-system.rispec.md +181 -0
- package/rispecs/borrowed_from_opencode/064-multi-level-config.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/065-jsonc-config.rispec.md +190 -0
- package/rispecs/borrowed_from_opencode/066-config-env-variables.rispec.md +153 -0
- package/rispecs/borrowed_from_opencode/067-config-deep-merging.rispec.md +178 -0
- package/rispecs/borrowed_from_opencode/068-remote-org-config.rispec.md +183 -0
- package/rispecs/borrowed_from_opencode/069-config-markdown-frontmatter.rispec.md +206 -0
- package/rispecs/borrowed_from_opencode/070-managed-config-directory.rispec.md +232 -0
- package/rispecs/borrowed_from_opencode/071-plugin-architecture.rispec.md +104 -0
- package/rispecs/borrowed_from_opencode/072-plugin-hooks.rispec.md +123 -0
- package/rispecs/borrowed_from_opencode/073-plugin-auto-install.rispec.md +115 -0
- package/rispecs/borrowed_from_opencode/074-permission-system.rispec.md +133 -0
- package/rispecs/borrowed_from_opencode/075-git-worktree-management.rispec.md +126 -0
- package/rispecs/borrowed_from_opencode/076-snapshot-system.rispec.md +124 -0
- package/rispecs/borrowed_from_opencode/077-snapshot-diff.rispec.md +117 -0
- package/rispecs/borrowed_from_opencode/078-snapshot-restore.rispec.md +128 -0
- package/rispecs/borrowed_from_opencode/079-worktree-branch-naming.rispec.md +122 -0
- package/rispecs/borrowed_from_opencode/080-sqlite-storage.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/081-database-migrations.rispec.md +148 -0
- package/rispecs/borrowed_from_opencode/082-database-transactions.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/083-deferred-effects.rispec.md +148 -0
- package/rispecs/borrowed_from_opencode/084-permission-rules.rispec.md +123 -0
- package/rispecs/borrowed_from_opencode/085-permission-glob-patterns.rispec.md +113 -0
- package/rispecs/borrowed_from_opencode/086-permission-merging.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/087-permission-modes.rispec.md +145 -0
- package/rispecs/borrowed_from_opencode/088-http-api-server.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/089-openapi-spec-generation.rispec.md +164 -0
- package/rispecs/borrowed_from_opencode/090-websocket-support.rispec.md +136 -0
- package/rispecs/borrowed_from_opencode/091-sse-streaming.rispec.md +168 -0
- package/rispecs/borrowed_from_opencode/092-mdns-discovery.rispec.md +145 -0
- package/rispecs/borrowed_from_opencode/093-javascript-sdk.rispec.md +200 -0
- package/rispecs/borrowed_from_opencode/094-skill-system.rispec.md +187 -0
- package/rispecs/borrowed_from_opencode/095-skill-discovery.rispec.md +182 -0
- package/rispecs/borrowed_from_opencode/096-desktop-remote-driving.rispec.md +175 -0
- package/rispecs/borrowed_from_opencode/INDEX.md +255 -0
- package/rispecs/core.rispecs.md +261 -0
- package/rispecs/engines.rispecs.md +241 -0
- package/rispecs/formatting.rispecs.md +252 -0
- package/rispecs/living-specifications.rispecs.md +361 -0
- package/rispecs/mcp.rispecs.md +197 -0
- package/rispecs/pde.rispecs.md +399 -0
- package/rispecs/pi-mono-envisionning/ENVISIONING.md +366 -0
- package/rispecs/pi-mono-envisionning/storytelling-horizon.rispecs.md +76 -0
- package/rispecs/pi-mono-envisionning/widget.rispecs.md +2 -0
- package/rispecs/relation-to-mcp-structural-thinking.kin.md +72 -0
- package/rispecs/research-for-better-framework/CLAUDE.md +7 -0
- package/rispecs/research-for-better-framework/survey-pi-openclaw-opencode-openhands.md +210 -0
- package/rispecs/session.rispecs.md +277 -0
- package/rispecs/stc.rispecs.md +138 -0
- package/rispecs/unifier.rispecs.md +317 -0
- package/scripts/LAUNCH--mcp-mia-code--testing--2603141315--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +2 -0
- package/scripts/RESUME--mia-code--mcps--260313--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +1 -0
- package/scripts/install-widget-in-home-pi-agent-extensions.sh +4 -0
- package/scripts/sample-decompose--2604011535-prompt.sh +1 -0
- package/skills/deep-search/AGENTS.md +17 -0
- package/skills/deep-search/SKILL.md +281 -0
- package/skills/deep-search/agent-templates.md +224 -0
- package/skills/deep-search/orchestration-patterns.md +95 -0
- package/skills/miaco-pde-inquiry-routing-deep-search/AGENTS.md +13 -0
- package/skills/miaco-pde-inquiry-routing-deep-search/SKILL.md +136 -0
- package/skills/miaco-pde-inquiry-routing-internal-external-relationship/AGENTS.md +4 -0
- package/skills/miaco-pde-inquiry-routing-internal-external-relationship/SKILL.md +157 -0
- package/skills/miaco-pde-inquiry-routing-local-qmd/AGENTS.md +42 -0
- package/skills/miaco-pde-inquiry-routing-local-qmd/SKILL.md +135 -0
- package/skills/qmd/AGENTS.md +3 -0
- package/skills/qmd/SKILL.md +144 -0
- package/skills/qmd/references/mcp-setup.md +102 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/SKILL.md +234 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/agent-templates.md +436 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/orchestration-patterns.md +197 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/ceremonial-technology.md +102 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/creative-orientation.md +99 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/prompt-decomposition.md +73 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/rise-framework.md +74 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/structural-tension.md +82 -0
- package/src/cli.ts +35 -11
- package/src/geminiHeadless.ts +7 -2
- package/src/index.ts +2 -1
- package/src/mcp/miaco-server.ts +13 -1
- package/src/mcp/miatel-server.ts +13 -1
- package/src/mcp/miawa-server.ts +13 -1
- package/src/mcp/utils.ts +41 -8
- package/src/sessionStore.ts +44 -4
- package/src/types.ts +2 -1
- package/widget/mia-ceremony/README.md +36 -0
- package/widget/mia-ceremony/index.ts +143 -0
- package/widget/mia-interceptor/README.md +39 -0
- package/widget/mia-interceptor/index.ts +221 -0
- package/widget/mia-tools/README.md +37 -0
- package/widget/mia-tools/index.ts +569 -0
- package/widget/miette-echo/README.md +44 -0
- package/widget/miette-echo/index.ts +164 -0
- package/.claude/settings.local.json +0 -9
- package/.hch/issue_.env +0 -4
- package/.hch/issue_add__2601211715.json +0 -77
- package/.hch/issue_add__2601211715.md +0 -4
- package/.hch/issue_add__2602242020.json +0 -78
- package/.hch/issue_add__2602242020.md +0 -7
- package/.hch/issues.json +0 -2312
- package/.hch/issues.md +0 -30
- package/WS__mia-code__260214__IAIP_PDE.code-workspace +0 -29
- package/WS__mia-code__src332__260122.code-workspace +0 -23
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +0 -6
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +0 -213
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +0 -243
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +0 -5
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
> ## Documentation Index
|
|
2
|
+
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
|
|
3
|
+
> Use this file to discover all available pages before exploring further.
|
|
4
|
+
|
|
5
|
+
# Retrieval
|
|
6
|
+
|
|
7
|
+
Large Language Models (LLMs) are powerful, but they have two key limitations:
|
|
8
|
+
|
|
9
|
+
* **Finite context** — they can’t ingest entire corpora at once.
|
|
10
|
+
* **Static knowledge** — their training data is frozen at a point in time.
|
|
11
|
+
|
|
12
|
+
Retrieval addresses these problems by fetching relevant external knowledge at query time. This is the foundation of **Retrieval-Augmented Generation (RAG)**: enhancing an LLM’s answers with context-specific information.
|
|
13
|
+
|
|
14
|
+
## Building a knowledge base
|
|
15
|
+
|
|
16
|
+
A **knowledge base** is a repository of documents or structured data used during retrieval.
|
|
17
|
+
|
|
18
|
+
If you need a custom knowledge base, you can use LangChain’s document loaders and vector stores to build one from your own data.
|
|
19
|
+
|
|
20
|
+
<Note>
|
|
21
|
+
If you already have a knowledge base (e.g., a SQL database, CRM, or internal documentation system), you do **not** need to rebuild it. You can:
|
|
22
|
+
|
|
23
|
+
* Connect it as a **tool** for an agent in Agentic RAG.
|
|
24
|
+
* Query it and supply the retrieved content as context to the LLM [(2-Step RAG)](#2-step-rag).
|
|
25
|
+
</Note>
|
|
26
|
+
|
|
27
|
+
See the following tutorial to build a searchable knowledge base and minimal RAG workflow:
|
|
28
|
+
|
|
29
|
+
<Card title="Tutorial: Semantic search" icon="database" href="/oss/python/langchain/knowledge-base" arrow cta="Learn more">
|
|
30
|
+
Learn how to create a searchable knowledge base from your own data using LangChain’s document loaders, embeddings, and vector stores.
|
|
31
|
+
In this tutorial, you’ll build a search engine over a PDF, enabling retrieval of passages relevant to a query. You’ll also implement a minimal RAG workflow on top of this engine to see how external knowledge can be integrated into LLM reasoning.
|
|
32
|
+
</Card>
|
|
33
|
+
|
|
34
|
+
### From retrieval to RAG
|
|
35
|
+
|
|
36
|
+
Retrieval allows LLMs to access relevant context at runtime. But most real-world applications go one step further: they **integrate retrieval with generation** to produce grounded, context-aware answers.
|
|
37
|
+
|
|
38
|
+
This is the core idea behind **Retrieval-Augmented Generation (RAG)**. The retrieval pipeline becomes a foundation for a broader system that combines search with generation.
|
|
39
|
+
|
|
40
|
+
### Retrieval pipeline
|
|
41
|
+
|
|
42
|
+
A typical retrieval workflow looks like this:
|
|
43
|
+
|
|
44
|
+
```mermaid theme={null}
|
|
45
|
+
flowchart LR
|
|
46
|
+
S(["Sources<br>(Google Drive, Slack, Notion, etc.)"]) --> L[Document Loaders]
|
|
47
|
+
L --> A([Documents])
|
|
48
|
+
A --> B[Split into chunks]
|
|
49
|
+
B --> C[Turn into embeddings]
|
|
50
|
+
C --> D[(Vector Store)]
|
|
51
|
+
Q([User Query]) --> E[Query embedding]
|
|
52
|
+
E --> D
|
|
53
|
+
D --> F[Retriever]
|
|
54
|
+
F --> G[LLM uses retrieved info]
|
|
55
|
+
G --> H([Answer])
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Each component is modular: you can swap loaders, splitters, embeddings, or vector stores without rewriting the app’s logic.
|
|
59
|
+
|
|
60
|
+
### Building blocks
|
|
61
|
+
|
|
62
|
+
<Columns cols={2}>
|
|
63
|
+
<Card title="Document loaders" icon="file-import" href="/oss/python/integrations/document_loaders" arrow cta="Learn more">
|
|
64
|
+
Ingest data from external sources (Google Drive, Slack, Notion, etc.), returning standardized [`Document`](https://reference.langchain.com/python/langchain_core/documents/#langchain_core.documents.base.Document) objects.
|
|
65
|
+
</Card>
|
|
66
|
+
|
|
67
|
+
<Card title="Text splitters" icon="scissors" href="/oss/python/integrations/splitters" arrow cta="Learn more">
|
|
68
|
+
Break large docs into smaller chunks that will be retrievable individually and fit within a model's context window.
|
|
69
|
+
</Card>
|
|
70
|
+
|
|
71
|
+
<Card title="Embedding models" icon="diagram-project" href="/oss/python/integrations/text_embedding" arrow cta="Learn more">
|
|
72
|
+
An embedding model turns text into a vector of numbers so that texts with similar meaning land close together in that vector space.
|
|
73
|
+
</Card>
|
|
74
|
+
|
|
75
|
+
<Card title="Vector stores" icon="database" href="/oss/python/integrations/vectorstores/" arrow cta="Learn more">
|
|
76
|
+
Specialized databases for storing and searching embeddings.
|
|
77
|
+
</Card>
|
|
78
|
+
|
|
79
|
+
<Card title="Retrievers" icon="binoculars" href="/oss/python/integrations/retrievers/" arrow cta="Learn more">
|
|
80
|
+
A retriever is an interface that returns documents given an unstructured query.
|
|
81
|
+
</Card>
|
|
82
|
+
</Columns>
|
|
83
|
+
|
|
84
|
+
## RAG architectures
|
|
85
|
+
|
|
86
|
+
RAG can be implemented in multiple ways, depending on your system's needs. We outline each type in the sections below.
|
|
87
|
+
|
|
88
|
+
| Architecture | Description | Control | Flexibility | Latency | Example Use Case |
|
|
89
|
+
| --------------- | -------------------------------------------------------------------------- | --------- | ----------- | ---------- | ------------------------------------------------- |
|
|
90
|
+
| **2-Step RAG** | Retrieval always happens before generation. Simple and predictable | ✅ High | ❌ Low | ⚡ Fast | FAQs, documentation bots |
|
|
91
|
+
| **Agentic RAG** | An LLM-powered agent decides *when* and *how* to retrieve during reasoning | ❌ Low | ✅ High | ⏳ Variable | Research assistants with access to multiple tools |
|
|
92
|
+
| **Hybrid** | Combines characteristics of both approaches with validation steps | ⚖️ Medium | ⚖️ Medium | ⏳ Variable | Domain-specific Q\&A with quality validation |
|
|
93
|
+
|
|
94
|
+
<Info>
|
|
95
|
+
**Latency**: Latency is generally more **predictable** in **2-Step RAG**, as the maximum number of LLM calls is known and capped. This predictability assumes that LLM inference time is the dominant factor. However, real-world latency may also be affected by the performance of retrieval steps—such as API response times, network delays, or database queries—which can vary based on the tools and infrastructure in use.
|
|
96
|
+
</Info>
|
|
97
|
+
|
|
98
|
+
### 2-step RAG
|
|
99
|
+
|
|
100
|
+
In **2-Step RAG**, the retrieval step is always executed before the generation step. This architecture is straightforward and predictable, making it suitable for many applications where the retrieval of relevant documents is a clear prerequisite for generating an answer.
|
|
101
|
+
|
|
102
|
+
```mermaid theme={null}
|
|
103
|
+
graph LR
|
|
104
|
+
A[User Question] --> B["Retrieve Relevant Documents"]
|
|
105
|
+
B --> C["Generate Answer"]
|
|
106
|
+
C --> D[Return Answer to User]
|
|
107
|
+
|
|
108
|
+
%% Styling
|
|
109
|
+
classDef startend fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#fff
|
|
110
|
+
classDef process fill:#1976d2,stroke:#0d47a1,stroke-width:1.5px,color:#fff
|
|
111
|
+
|
|
112
|
+
class A,D startend
|
|
113
|
+
class B,C process
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
<Card title="Tutorial: Retrieval-Augmented Generation (RAG)" icon="robot" href="/oss/python/langchain/rag#rag-chains" arrow cta="Learn more">
|
|
117
|
+
See how to build a Q\&A chatbot that can answer questions grounded in your data using Retrieval-Augmented Generation.
|
|
118
|
+
This tutorial walks through two approaches:
|
|
119
|
+
|
|
120
|
+
* A **RAG agent** that runs searches with a flexible tool—great for general-purpose use.
|
|
121
|
+
* A **2-step RAG** chain that requires just one LLM call per query—fast and efficient for simpler tasks.
|
|
122
|
+
</Card>
|
|
123
|
+
|
|
124
|
+
### Agentic RAG
|
|
125
|
+
|
|
126
|
+
**Agentic Retrieval-Augmented Generation (RAG)** combines the strengths of Retrieval-Augmented Generation with agent-based reasoning. Instead of retrieving documents before answering, an agent (powered by an LLM) reasons step-by-step and decides **when** and **how** to retrieve information during the interaction.
|
|
127
|
+
|
|
128
|
+
<Tip>
|
|
129
|
+
The only thing an agent needs to enable RAG behavior is access to one or more **tools** that can fetch external knowledge — such as documentation loaders, web APIs, or database queries.
|
|
130
|
+
</Tip>
|
|
131
|
+
|
|
132
|
+
```mermaid theme={null}
|
|
133
|
+
graph LR
|
|
134
|
+
A[User Input / Question] --> B["Agent (LLM)"]
|
|
135
|
+
B --> C{Need external info?}
|
|
136
|
+
C -- Yes --> D["Search using tool(s)"]
|
|
137
|
+
D --> H{Enough to answer?}
|
|
138
|
+
H -- No --> B
|
|
139
|
+
H -- Yes --> I[Generate final answer]
|
|
140
|
+
C -- No --> I
|
|
141
|
+
I --> J[Return to user]
|
|
142
|
+
|
|
143
|
+
%% Dark-mode friendly styling
|
|
144
|
+
classDef startend fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#fff
|
|
145
|
+
classDef decision fill:#f9a825,stroke:#f57f17,stroke-width:2px,color:#000
|
|
146
|
+
classDef process fill:#1976d2,stroke:#0d47a1,stroke-width:1.5px,color:#fff
|
|
147
|
+
|
|
148
|
+
class A,J startend
|
|
149
|
+
class B,D,I process
|
|
150
|
+
class C,H decision
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```python theme={null}
|
|
154
|
+
import requests
|
|
155
|
+
from langchain.tools import tool
|
|
156
|
+
from langchain.chat_models import init_chat_model
|
|
157
|
+
from langchain.agents import create_agent
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@tool
|
|
161
|
+
def fetch_url(url: str) -> str:
|
|
162
|
+
"""Fetch text content from a URL"""
|
|
163
|
+
response = requests.get(url, timeout=10.0)
|
|
164
|
+
response.raise_for_status()
|
|
165
|
+
return response.text
|
|
166
|
+
|
|
167
|
+
system_prompt = """\
|
|
168
|
+
Use fetch_url when you need to fetch information from a web-page; quote relevant snippets.
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
agent = create_agent(
|
|
172
|
+
model="claude-sonnet-4-5-20250929",
|
|
173
|
+
tools=[fetch_url], # A tool for retrieval [!code highlight]
|
|
174
|
+
system_prompt=system_prompt,
|
|
175
|
+
)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
<Expandable title="Extended example: Agentic RAG for LangGraph's llms.txt">
|
|
179
|
+
This example implements an **Agentic RAG system** to assist users in querying LangGraph documentation. The agent begins by loading [llms.txt](https://llmstxt.org/), which lists available documentation URLs, and can then dynamically use a `fetch_documentation` tool to retrieve and process the relevant content based on the user’s question.
|
|
180
|
+
|
|
181
|
+
```python theme={null}
|
|
182
|
+
import requests
|
|
183
|
+
from langchain.agents import create_agent
|
|
184
|
+
from langchain.messages import HumanMessage
|
|
185
|
+
from langchain.tools import tool
|
|
186
|
+
from markdownify import markdownify
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
ALLOWED_DOMAINS = ["https://langchain-ai.github.io/"]
|
|
190
|
+
LLMS_TXT = 'https://langchain-ai.github.io/langgraph/llms.txt'
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
@tool
|
|
194
|
+
def fetch_documentation(url: str) -> str: # [!code highlight]
|
|
195
|
+
"""Fetch and convert documentation from a URL"""
|
|
196
|
+
if not any(url.startswith(domain) for domain in ALLOWED_DOMAINS):
|
|
197
|
+
return (
|
|
198
|
+
"Error: URL not allowed. "
|
|
199
|
+
f"Must start with one of: {', '.join(ALLOWED_DOMAINS)}"
|
|
200
|
+
)
|
|
201
|
+
response = requests.get(url, timeout=10.0)
|
|
202
|
+
response.raise_for_status()
|
|
203
|
+
return markdownify(response.text)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# We will fetch the content of llms.txt, so this can
|
|
207
|
+
# be done ahead of time without requiring an LLM request.
|
|
208
|
+
llms_txt_content = requests.get(LLMS_TXT).text
|
|
209
|
+
|
|
210
|
+
# System prompt for the agent
|
|
211
|
+
system_prompt = f"""
|
|
212
|
+
You are an expert Python developer and technical assistant.
|
|
213
|
+
Your primary role is to help users with questions about LangGraph and related tools.
|
|
214
|
+
|
|
215
|
+
Instructions:
|
|
216
|
+
|
|
217
|
+
1. If a user asks a question you're unsure about — or one that likely involves API usage,
|
|
218
|
+
behavior, or configuration — you MUST use the `fetch_documentation` tool to consult the relevant docs.
|
|
219
|
+
2. When citing documentation, summarize clearly and include relevant context from the content.
|
|
220
|
+
3. Do not use any URLs outside of the allowed domain.
|
|
221
|
+
4. If a documentation fetch fails, tell the user and proceed with your best expert understanding.
|
|
222
|
+
|
|
223
|
+
You can access official documentation from the following approved sources:
|
|
224
|
+
|
|
225
|
+
{llms_txt_content}
|
|
226
|
+
|
|
227
|
+
You MUST consult the documentation to get up to date documentation
|
|
228
|
+
before answering a user's question about LangGraph.
|
|
229
|
+
|
|
230
|
+
Your answers should be clear, concise, and technically accurate.
|
|
231
|
+
"""
|
|
232
|
+
|
|
233
|
+
tools = [fetch_documentation]
|
|
234
|
+
|
|
235
|
+
model = init_chat_model("claude-sonnet-4-0", max_tokens=32_000)
|
|
236
|
+
|
|
237
|
+
agent = create_agent(
|
|
238
|
+
model=model,
|
|
239
|
+
tools=tools, # [!code highlight]
|
|
240
|
+
system_prompt=system_prompt, # [!code highlight]
|
|
241
|
+
name="Agentic RAG",
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
response = agent.invoke({
|
|
245
|
+
'messages': [
|
|
246
|
+
HumanMessage(content=(
|
|
247
|
+
"Write a short example of a langgraph agent using the "
|
|
248
|
+
"prebuilt create react agent. the agent should be able "
|
|
249
|
+
"to look up stock pricing information."
|
|
250
|
+
))
|
|
251
|
+
]
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
print(response['messages'][-1].content)
|
|
255
|
+
```
|
|
256
|
+
</Expandable>
|
|
257
|
+
|
|
258
|
+
<Card title="Tutorial: Retrieval-Augmented Generation (RAG)" icon="robot" href="/oss/python/langchain/rag" arrow cta="Learn more">
|
|
259
|
+
See how to build a Q\&A chatbot that can answer questions grounded in your data using Retrieval-Augmented Generation.
|
|
260
|
+
This tutorial walks through two approaches:
|
|
261
|
+
|
|
262
|
+
* A **RAG agent** that runs searches with a flexible tool—great for general-purpose use.
|
|
263
|
+
* A **2-step RAG** chain that requires just one LLM call per query—fast and efficient for simpler tasks.
|
|
264
|
+
</Card>
|
|
265
|
+
|
|
266
|
+
### Hybrid RAG
|
|
267
|
+
|
|
268
|
+
Hybrid RAG combines characteristics of both 2-Step and Agentic RAG. It introduces intermediate steps such as query preprocessing, retrieval validation, and post-generation checks. These systems offer more flexibility than fixed pipelines while maintaining some control over execution.
|
|
269
|
+
|
|
270
|
+
Typical components include:
|
|
271
|
+
|
|
272
|
+
* **Query enhancement**: Modify the input question to improve retrieval quality. This can involve rewriting unclear queries, generating multiple variations, or expanding queries with additional context.
|
|
273
|
+
* **Retrieval validation**: Evaluate whether retrieved documents are relevant and sufficient. If not, the system may refine the query and retrieve again.
|
|
274
|
+
* **Answer validation**: Check the generated answer for accuracy, completeness, and alignment with source content. If needed, the system can regenerate or revise the answer.
|
|
275
|
+
|
|
276
|
+
The architecture often supports multiple iterations between these steps:
|
|
277
|
+
|
|
278
|
+
```mermaid theme={null}
|
|
279
|
+
graph LR
|
|
280
|
+
A[User Question] --> B[Query Enhancement]
|
|
281
|
+
B --> C[Retrieve Documents]
|
|
282
|
+
C --> D{Sufficient Info?}
|
|
283
|
+
D -- No --> E[Refine Query]
|
|
284
|
+
E --> C
|
|
285
|
+
D -- Yes --> F[Generate Answer]
|
|
286
|
+
F --> G{Answer Quality OK?}
|
|
287
|
+
G -- No --> H{Try Different Approach?}
|
|
288
|
+
H -- Yes --> E
|
|
289
|
+
H -- No --> I[Return Best Answer]
|
|
290
|
+
G -- Yes --> I
|
|
291
|
+
I --> J[Return to User]
|
|
292
|
+
|
|
293
|
+
classDef startend fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#fff
|
|
294
|
+
classDef decision fill:#f9a825,stroke:#f57f17,stroke-width:2px,color:#000
|
|
295
|
+
classDef process fill:#1976d2,stroke:#0d47a1,stroke-width:1.5px,color:#fff
|
|
296
|
+
|
|
297
|
+
class A,J startend
|
|
298
|
+
class B,C,E,F,I process
|
|
299
|
+
class D,G,H decision
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
This architecture is suitable for:
|
|
303
|
+
|
|
304
|
+
* Applications with ambiguous or underspecified queries
|
|
305
|
+
* Systems that require validation or quality control steps
|
|
306
|
+
* Workflows involving multiple sources or iterative refinement
|
|
307
|
+
|
|
308
|
+
<Card title="Tutorial: Agentic RAG with Self-Correction" icon="robot" href="/oss/python/langgraph/agentic-rag" arrow cta="Learn more">
|
|
309
|
+
An example of **Hybrid RAG** that combines agentic reasoning with retrieval and self-correction.
|
|
310
|
+
</Card>
|
|
311
|
+
|
|
312
|
+
***
|
|
313
|
+
|
|
314
|
+
<Callout icon="pen-to-square" iconType="regular">
|
|
315
|
+
[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/langchain/retrieval.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
|
|
316
|
+
</Callout>
|
|
317
|
+
|
|
318
|
+
<Tip icon="terminal" iconType="regular">
|
|
319
|
+
[Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
|
|
320
|
+
</Tip>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
> ## Documentation Index
|
|
2
|
+
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
|
|
3
|
+
> Use this file to discover all available pages before exploring further.
|
|
4
|
+
|
|
5
|
+
# Runtime
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
LangChain's [`create_agent`](https://reference.langchain.com/python/langchain/agents/#langchain.agents.create_agent) runs on LangGraph's runtime under the hood.
|
|
10
|
+
|
|
11
|
+
LangGraph exposes a [`Runtime`](https://reference.langchain.com/python/langgraph/runtime/#langgraph.runtime.Runtime) object with the following information:
|
|
12
|
+
|
|
13
|
+
1. **Context**: static information like user id, db connections, or other dependencies for an agent invocation
|
|
14
|
+
2. **Store**: a [BaseStore](https://reference.langchain.com/python/langgraph/store/#langgraph.store.base.BaseStore) instance used for [long-term memory](/oss/python/langchain/long-term-memory)
|
|
15
|
+
3. **Stream writer**: an object used for streaming information via the `"custom"` stream mode
|
|
16
|
+
|
|
17
|
+
<Tip>
|
|
18
|
+
Runtime context provides **dependency injection** for your tools and middleware. Instead of hardcoding values or using global state, you can inject runtime dependencies (like database connections, user IDs, or configuration) when invoking your agent. This makes your tools more testable, reusable, and flexible.
|
|
19
|
+
</Tip>
|
|
20
|
+
|
|
21
|
+
You can access the runtime information within [tools](#inside-tools) and [middleware](#inside-middleware).
|
|
22
|
+
|
|
23
|
+
## Access
|
|
24
|
+
|
|
25
|
+
When creating an agent with [`create_agent`](https://reference.langchain.com/python/langchain/agents/#langchain.agents.create_agent), you can specify a `context_schema` to define the structure of the `context` stored in the agent [`Runtime`](https://reference.langchain.com/python/langgraph/runtime/#langgraph.runtime.Runtime).
|
|
26
|
+
|
|
27
|
+
When invoking the agent, pass the `context` argument with the relevant configuration for the run:
|
|
28
|
+
|
|
29
|
+
```python theme={null}
|
|
30
|
+
from dataclasses import dataclass
|
|
31
|
+
|
|
32
|
+
from langchain.agents import create_agent
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class Context:
|
|
37
|
+
user_name: str
|
|
38
|
+
|
|
39
|
+
agent = create_agent(
|
|
40
|
+
model="gpt-5-nano",
|
|
41
|
+
tools=[...],
|
|
42
|
+
context_schema=Context # [!code highlight]
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
agent.invoke(
|
|
46
|
+
{"messages": [{"role": "user", "content": "What's my name?"}]},
|
|
47
|
+
context=Context(user_name="John Smith") # [!code highlight]
|
|
48
|
+
)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Inside tools
|
|
52
|
+
|
|
53
|
+
You can access the runtime information inside tools to:
|
|
54
|
+
|
|
55
|
+
* Access the context
|
|
56
|
+
* Read or write long-term memory
|
|
57
|
+
* Write to the [custom stream](/oss/python/langchain/streaming#custom-updates) (ex, tool progress / updates)
|
|
58
|
+
|
|
59
|
+
Use the `ToolRuntime` parameter to access the [`Runtime`](https://reference.langchain.com/python/langgraph/runtime/#langgraph.runtime.Runtime) object inside a tool.
|
|
60
|
+
|
|
61
|
+
```python theme={null}
|
|
62
|
+
from dataclasses import dataclass
|
|
63
|
+
from langchain.tools import tool, ToolRuntime # [!code highlight]
|
|
64
|
+
|
|
65
|
+
@dataclass
|
|
66
|
+
class Context:
|
|
67
|
+
user_id: str
|
|
68
|
+
|
|
69
|
+
@tool
|
|
70
|
+
def fetch_user_email_preferences(runtime: ToolRuntime[Context]) -> str: # [!code highlight]
|
|
71
|
+
"""Fetch the user's email preferences from the store."""
|
|
72
|
+
user_id = runtime.context.user_id # [!code highlight]
|
|
73
|
+
|
|
74
|
+
preferences: str = "The user prefers you to write a brief and polite email."
|
|
75
|
+
if runtime.store: # [!code highlight]
|
|
76
|
+
if memory := runtime.store.get(("users",), user_id): # [!code highlight]
|
|
77
|
+
preferences = memory.value["preferences"]
|
|
78
|
+
|
|
79
|
+
return preferences
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Inside middleware
|
|
83
|
+
|
|
84
|
+
You can access runtime information in middleware to create dynamic prompts, modify messages, or control agent behavior based on user context.
|
|
85
|
+
|
|
86
|
+
Use the `Runtime` parameter to access the [`Runtime`](https://reference.langchain.com/python/langgraph/runtime/#langgraph.runtime.Runtime) object inside [node-style hooks](/oss/python/langchain/middleware/custom#node-style-hooks). For [wrap-style hooks](/oss/python/langchain/middleware/custom#wrap-style-hooks), the `Runtime` object is available inside the [`ModelRequest`](https://reference.langchain.com/python/langchain/middleware/#langchain.agents.middleware.ModelRequest) parameter.
|
|
87
|
+
|
|
88
|
+
```python theme={null}
|
|
89
|
+
from dataclasses import dataclass
|
|
90
|
+
|
|
91
|
+
from langchain.messages import AnyMessage
|
|
92
|
+
from langchain.agents import create_agent, AgentState
|
|
93
|
+
from langchain.agents.middleware import dynamic_prompt, ModelRequest, before_model, after_model
|
|
94
|
+
from langgraph.runtime import Runtime
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@dataclass
|
|
98
|
+
class Context:
|
|
99
|
+
user_name: str
|
|
100
|
+
|
|
101
|
+
# Dynamic prompts
|
|
102
|
+
@dynamic_prompt
|
|
103
|
+
def dynamic_system_prompt(request: ModelRequest) -> str:
|
|
104
|
+
user_name = request.runtime.context.user_name # [!code highlight]
|
|
105
|
+
system_prompt = f"You are a helpful assistant. Address the user as {user_name}."
|
|
106
|
+
return system_prompt
|
|
107
|
+
|
|
108
|
+
# Before model hook
|
|
109
|
+
@before_model
|
|
110
|
+
def log_before_model(state: AgentState, runtime: Runtime[Context]) -> dict | None: # [!code highlight]
|
|
111
|
+
print(f"Processing request for user: {runtime.context.user_name}") # [!code highlight]
|
|
112
|
+
return None
|
|
113
|
+
|
|
114
|
+
# After model hook
|
|
115
|
+
@after_model
|
|
116
|
+
def log_after_model(state: AgentState, runtime: Runtime[Context]) -> dict | None: # [!code highlight]
|
|
117
|
+
print(f"Completed request for user: {runtime.context.user_name}") # [!code highlight]
|
|
118
|
+
return None
|
|
119
|
+
|
|
120
|
+
agent = create_agent(
|
|
121
|
+
model="gpt-5-nano",
|
|
122
|
+
tools=[...],
|
|
123
|
+
middleware=[dynamic_system_prompt, log_before_model, log_after_model], # [!code highlight]
|
|
124
|
+
context_schema=Context
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
agent.invoke(
|
|
128
|
+
{"messages": [{"role": "user", "content": "What's my name?"}]},
|
|
129
|
+
context=Context(user_name="John Smith")
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
***
|
|
134
|
+
|
|
135
|
+
<Callout icon="pen-to-square" iconType="regular">
|
|
136
|
+
[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/langchain/runtime.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
|
|
137
|
+
</Callout>
|
|
138
|
+
|
|
139
|
+
<Tip icon="terminal" iconType="regular">
|
|
140
|
+
[Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
|
|
141
|
+
</Tip>
|