These examples are written for the Action-based runtime. Every numbered example
creates a request-scoped turn, passes turn.prompt into
agent.get_action_result(...) to inspect intermediate ActionResult records
first, then uses turn.get_result() to produce the final DeepSeek reply
through OpenAICompatible.
Before running them, set:
DEEPSEEK_API_KEYDEEPSEEK_BASE_URL(optional, defaults tohttps://api.deepseek.com/v1)DEEPSEEK_DEFAULT_MODEL(optional, defaults todeepseek-chat)
Example groups:
- Function actions
1_1_function_action_func_deepseek.py1_2_function_register_action_deepseek.py
- MCP actions
2_1_mcp_stdio_action_deepseek.py2_2_mcp_http_action_deepseek.py_calculator_mcp_server.pyis the shared local MCP server
- Built-in action packages
- See
examples/builtin_actions/for Search/Browse package mounting and local browse examples.
- See
- Sandbox actions
3_1_python_sandbox_action_deepseek.py3_2_bash_sandbox_action_deepseek.py3_3_third_party_sandlock_action_deepseek.py3_4_third_party_docker_sandbox_action_deepseek.py3_5_action_execution_recall_local.py
- Plugin customization examples
4_1_custom_action_executor_plugin_local.py4_2_custom_action_runtime_plugin_local.py4_3_custom_action_flow_plugin_local.py
- Cookbook patterns
- See
examples/cookbook/for model-backed Action loop, router, concurrent todo, reflection, and safe shell policy patterns adapted from practical app-development training material.
- See
Shared helper:
_shared.pyloads.env, configures DeepSeek, prints intermediate action records, and prints final reply logs fromresult.full_result_data["extra"]["action_logs"]
Notes:
- Every numbered example registers or imports actions, mounts them on an agent, runs a real prompt, prints intermediate action records, and then prints the final reply plus
extra.action_logs. - Future action examples must be runnable in their declared environment and must include an
Expected key outputcomment in the file. For model-backed examples, the comment should describe the stable action/result shape rather than an exact model sentence. - Cookbook examples must call DeepSeek or local Ollama for planner/classifier/evaluator/reviser steps. Local functions are acceptable only as the business capability being called by an Action or workflow step, not as a model-decision substitute.
- By default,
agent.get_action_result(prompt=turn.prompt)storesaction_resultson that turn prompt so the followingturn.get_result()can reuse those intermediate results instead of executing the action loop again. Passstore_for_reply=Falsewhen you only want isolated inspection. - Instruction-heavy actions expose compact
model_digestdata to later model context and keep full raw input/output behindartifact_refs;3_5_action_execution_recall_local.pyshows explicit artifact recall throughagent.action.read_action_artifact(...). 3_3_third_party_sandlock_action_deepseek.pydemonstrates a Linux SandLock third-party sandbox executor registered through the newActionExecutorplugin type.3_4_third_party_docker_sandbox_action_deepseek.pydemonstrates a local Docker third-party sandbox executor registered through the newActionExecutorplugin type.4_1to4_3focus on extension points forActionExecutor,ActionRuntime, andActionFlow, and also run through an agent with DeepSeek for the final reply.- The SandLock example requires Linux 6.7+ and
pip install sandlock. - The Docker sandbox example requires a local Docker daemon that is running and not paused. It auto-pulls
alpine:3.20when the image is not available locally.