Building an agent?

An agent without context
stalls at step three.

Agents fail mid-task because they hit a step that requires knowledge they were never given. Docklee is the context layer that provides the right memory and knowledge at every step of your agent's execution. Not just at startup. At each decision point.

  • Context fetched per-step, not once at init. Each step gets what it actually needs
  • Memory and knowledge queried in parallel. No added latency between steps
  • Persistent results: what the agent learns in step 2 is available in step 5
Task: Prepare personalised outreach for 3 at-risk accounts
Running
  1. Identify at-risk accounts

  2. Fetch interaction history

  3. Check communication preferences

  4. Draft personalised emails

An agent is only as autonomous as its context allows. Without the right knowledge at each step, agents stall silently or produce output that needs human correction.

Without Docklee

Agent receives the task and starts. By step 3 it needs user preferences it was never given. It either guesses or halts.

With Docklee

Docklee fetches memory for each step that requires it. Step 3 gets the preferences. The agent never halts.

Without Docklee

Your agent's knowledge is frozen at prompt time. If the task involves current docs, policies, or data, it works from stale context.

With Docklee

Knowledge base retrieval is per-step. Each step gets the specific documents relevant to what it is actually doing at that moment.

Without Docklee

What the agent learns in step 2 is gone by step 5. Every step starts cold because there's no way to persist findings between steps.

With Docklee

dock.capture() writes step results back to user memory. Step 5 can read what step 2 discovered. Tasks build on themselves.

How it works

Context at every step.
Not just at the start.

Step 01

Your agent plans and begins

Your agent receives the task and generates a step plan using your existing LLM. Nothing about your agent architecture changes. Docklee is called inside the step execution loop, not during planning.

Step 02

Docklee fetches context for each step

Before each step executes, you call Lynk with the current step, the task, and any previous results. Docklee queries the user's memory and the relevant knowledge base in parallel and returns a composed system prompt in under 50ms.

Step 03

Step completes. Results persist.

The LLM executes the step with full context. After completion, you call dock.capture() to write what was learned back to the user's memory. The next step can read it. The same task run tomorrow starts with a richer foundation.

Prepare personalised outreach for 3 at-risk accountsAgent decision point
Step: Fetch interaction history

No context

Agent needs: Memory: last 90 days of activity

Docklee context

Agent needs: Memory: last 90 days of activity

Where agents stall

Any multi-step task that touches user data or knowledge.

If your agent runs more than two steps and any of those steps needs information beyond the original task prompt, Docklee prevents the stall.

Research and outreach agents

Agent identifies targets in step 1 but stalls in step 3 when it needs communication preferences, interaction history, and relationship context to personalise.

Docklee fetches the right memory per step. Outreach is personalised, timed correctly, and references the actual relationship history without human review.

Triage and classification agents

Agent reads the ticket or issue in step 1 but cannot determine correct priority, owner, or SLA in step 2 without account tier, team workload, and routing rules.

Step context includes account tier from memory and routing rules from KB. Every classification decision is grounded in the actual rules, not model intuition.

Documentation and writing agents

Agent knows what changed from the diff, but stalls when it needs to fetch the current docs, identify owners, apply the style guide, and follow the review process.

KB retrieval per step gives the agent the current docs, style guide, and templates exactly when each step needs them. Ownership from memory drives PR routing.

Workflow automation agents

Agents running recurring workflows re-discover the same information every run because nothing from previous runs is persisted and available to the next one.

Persist() writes findings back to user memory after each run. Subsequent runs start with prior results and get progressively faster and more accurate.

What Docklee adds

Everything an autonomous agent needs to complete tasks.

Per-step context fetch

Context is fetched inside the step loop, not once at init. Each step receives only the memory and knowledge that is relevant to what that specific step is doing.

Parallel source queries

Memory and knowledge base are queried simultaneously. Context assembly adds under 50ms per step. Your agent loop does not slow down when context is requested.

Persistent step results

Call dock.capture() after each step to write findings back to user memory. The next step in the same task, and the next run of the same task, both start with richer context.

Knowledge retrieval per step

The knowledge base query is anchored to the current step description. Step 2 gets docs relevant to step 2. Step 4 gets different docs. No irrelevant context in your prompt window.

User-scoped memory access

Memory fetched per step is scoped to the requesting user. Agents running tasks for different users cannot access each other's history. Access control is enforced at the Docklee layer.

No agent infrastructure changes

You call Docklee's API inside your existing step execution loop. Your agent framework, LLM provider, and orchestration logic stay exactly as they are. One function call added per step.

Integration

One function inside
your step loop.

The "Before" tab shows a typical agent loop. The "After" tab shows the exact change: lynk.recall() before each LLM call, and dock.capture() after.

  • Works with any agent framework: LangChain, AutoGen, custom loops
  • Works with any LLM: GPT, Claude, Gemini, Llama, Mistral
  • persist() is optional; use it when steps produce useful findings
  • Citations returned per step for traceability and debugging
Agent loop with Docklee step context
import { Dock, Lynk } from "docklee";
const lynk = new Lynk({ engineId: "eng_playbooks", memorySpaceId: "space_agents" });
const dock = new Dock({ memorySpaceId: "space_agents" });
async function runTask(userId, taskDescription) {
const plan = await llm.plan(taskDescription);
const results = [];
for (const step of plan.steps) {
// Fetch context relevant to THIS specific step:
// this user's memory and the playbooks that apply.
const [memories, docs] = await Promise.all([
lynk.recall(step, { endUser: userId, topK: 5 }),
lynk.retrieve(`${taskDescription}: ${step}`, { topK: 5 }),
]);
const result = await llm.run({
messages: [
{ role: "system", content: buildContext(memories, docs) },
{ role: "user", content: `Task: ${taskDescription}\nStep: ${step}` },
],
});
// Persist insights for subsequent steps and future runs
dock.capture(result.insights, { type: "event", endUser: userId });
results.push({ step, output: result.content });
}
await dock.flush();
return results; // Every step completes. No silent stalls.
}

Building an agent?

Let your agent finish
what it starts.

One call per step. Full context at every decision point. Tasks complete without human intervention.