AgentCore is the reasoning engine at the heart of CLIver. It implements the Re-Act loop —
send messages to an LLM, execute tools, feed results back, and continue until a final response
is ready.
The Re-Act Loop
Section titled “The Re-Act Loop”1. Receive user input2. Build messages (system prompt + conversation history + user input)3. Send to LLM4. If the LLM returns a tool call → execute tools → go to step 35. If the LLM returns text → done, return the responseThe loop runs up to 50 iterations by default, with a safety limit of 5 consecutive tool errors before stopping.
Quick Example
Section titled “Quick Example”import asyncio
from cliver_core import AgentCore, ModelBindings, presetsfrom cliver_core.tools import discover_builtin_tools
async def main(): agent = AgentCore( ModelBindings(llm=presets.deepseek(api_key="...")), builtin_tools=discover_builtin_tools(), ) response = await agent.chat("List the files in this directory.") print(response.message.content) await agent.aclose()
asyncio.run(main())Key Properties
Section titled “Key Properties”- Embeddable.
AgentCorehas zero CLI dependencies — it takes Python objects and returns message objects. - Stateless instance, stateful calls. Conversation context is passed per call
(
conversation=), so one instance is safe for concurrent chats. - Bindings, not config files. Every model purpose — chat, image, video, TTS, ASR, embed,
rerank — lives in
ModelBindings. - Lazy call-time resolution. Extra tools, MCP servers, tool filters, and skill dispatch are
resolved per
chat()/stream()call. - Observable. Pass
on_event=to receive inference and tool lifecycle events, includingtool.start,tool.end,tool.error, andtool.permission_denied.
Calling the Agent
Section titled “Calling the Agent”chat() returns the final CLIverResponse; stream() yields CLIverMessageChunk objects as
content arrives. Both accept the same per-call options:
| Parameter | Description |
|---|---|
user_input | The user’s message |
system_prompt | Additional system content for this call |
conversation | Previous messages for multi-turn context |
media | Images/audio/video attached to the user message |
extra_tools | Additional tools for this call only |
mcp_servers | MCP server names to advertise for this call |
tool_filter | Predicate that narrows the advertised tool set |
options | Wire request options; call site overrides binding defaults |
max_iterations | Max Re-Act iterations (default 50) |
execution_policy | Ambient tool-execution policy for this call |
skill_dispatch | Advertise the skill catalogue and dispatch tools (default on) |
When finished, call await agent.aclose() to close providers the agent built.