feat(ai-stack): metrics, named handles, prompt docs, backends, zero-LLM
Finish ai-stack steps 1–5: model_turn usage, fast/reasoning, type:prompt load, openai/ollama split, and agent-zero-llm gold. Fix compiled-skill Marqdo syntax so llm_free await no longer falls through to plan+HTTP. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1f8e61f3bf
commit
d8d435fead
16 files changed
+738
-198
No files matched your search
@@ -0,0 +1,60 @@
|
||||
---
|
||||
title: Agent zero-LLM execution after policy/skill compile
|
||||
description: After Skill+Policy compilation, run with router=marqdo records llm_calls=0.
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
**p = > plugin.native_path name="agent"**
|
||||
1. `p`
|
||||
> plugin.load path=`p`
|
||||
2. *
|
||||
> print text=no-agent-plugin
|
||||
> sys.exit code=1
|
||||
|
||||
**paths = > json.parse text={"mem":".marqdo/agent-memory-zero-llm","kb":".marqdo/agent-kb-zero-llm","task":"Reply with exactly the word pong and nothing else.","skill":"concepts/skills/reply-with-exactly-the-word-pong-and-nothing-els.md"}**
|
||||
**mem = > json.get value=`paths` key="mem"**
|
||||
**kb = > json.get value=`paths` key="kb"**
|
||||
**task = > json.get value=`paths` key="task"**
|
||||
**skill = > json.get value=`paths` key="skill"**
|
||||
|
||||
**ex_m = > fs.exists path=`mem`**
|
||||
1. `ex_m`
|
||||
> fs.remove_tree path=`mem`
|
||||
2. *
|
||||
**_ = 1**
|
||||
**ex_k = > fs.exists path=`kb`**
|
||||
1. `ex_k`
|
||||
> fs.remove_tree path=`kb`
|
||||
2. *
|
||||
**_ = 1**
|
||||
> agent_memory_ensure memory_dir=`mem`
|
||||
|
||||
**_ = > agent_record_episode task=`task` status="ok" result="pong" mode="explore" skill=`skill` llm_calls=2 tokens=100 memory_dir=`mem`**
|
||||
**_ = > agent_record_episode task=`task` status="ok" result="pong" mode="explore" skill=`skill` llm_calls=2 tokens=80 memory_dir=`mem`**
|
||||
**_ = > agent_record_episode task=`task` status="ok" result="pong" mode="explore" skill=`skill` llm_calls=1 tokens=40 memory_dir=`mem`**
|
||||
**_ = > agent_maybe_learn task=`task` memory_dir=`mem` kb_dir=`kb` improve_every=3 promote=True**
|
||||
**_ = > agent_record_episode task=`task` status="ok" result="pong" mode="compiled" skill=`skill` llm_calls=0 tokens=0 memory_dir=`mem`**
|
||||
**_ = > agent_record_episode task=`task` status="ok" result="pong" mode="compiled" skill=`skill` llm_calls=0 tokens=0 memory_dir=`mem`**
|
||||
**_ = > agent_record_episode task=`task` status="ok" result="pong" mode="compiled" skill=`skill` llm_calls=0 tokens=0 memory_dir=`mem`**
|
||||
**_ = > agent_compile_policy memory_dir=`mem` min_evidence=3**
|
||||
|
||||
**model = > llm.create**
|
||||
`tools` =
|
||||
|
||||
| 工具 |
|
||||
|------|
|
||||
|
||||
**ag = > agent.agent model=`model` tools=`tools` standing="zero-llm compiled run"**
|
||||
**out = > `ag`.run task=`task` kb_dir=`kb` memory_dir=`mem` learn=False router="marqdo" writeback=False**
|
||||
**ex = > json.get value=`out` key="execution"**
|
||||
**calls = > json.get value=`ex` key="llm_calls"**
|
||||
**mode = > json.get value=`ex` key="mode"**
|
||||
> print text=`mode`
|
||||
> print text=`calls`
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
type: prompt
|
||||
model: gpt-4o-mini
|
||||
---
|
||||
|
||||
Explain Marqdo as an AI-native programming language.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Be concise.
|
||||
- Mention executable documents.
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
type: prompt
|
||||
title: marqdo-one-liner
|
||||
---
|
||||
|
||||
Reply with exactly one English word: pong
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: llm named handles + prompt_load offline
|
||||
description: fast/reasoning names, ollama backend tag, and type:prompt body load; no network.
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import text:lib/text.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
**fast = > llm.fast model="qwen-fast-test"**
|
||||
> print text=[name](`fast`)
|
||||
> print text=[model](`fast`)
|
||||
|
||||
**reason = > llm.reasoning model="gpt-reason-test"**
|
||||
> print text=[name](`reason`)
|
||||
> print text=[model](`reason`)
|
||||
|
||||
**ollama = > llm.create backend="ollama" model="llama3.2"**
|
||||
> print text=[backend](`ollama`)
|
||||
> print text=[model](`ollama`)
|
||||
|
||||
**prompt = > llm.prompt_load path="fixtures/prompt-marqdo.md"**
|
||||
**has = > text.contains text=`prompt` sub="Explain Marqdo"**
|
||||
**no_fm = > text.contains text=`prompt` sub="type: prompt"**
|
||||
> print text=`has`
|
||||
> print text=`no_fm`
|
||||
Reference in new issue
Block a user