System Tools
Understand built-in web search, code execution, and reasoning tools.
#System Tools Guide
Some capabilities are useful to almost every agent: searching the web, running a quick calculation, and thinking through a hard problem. mAIvn provides these as built-in system tools. They are off until you allow them by name.
This guide explains what each system tool does, how the runtime keeps private data safe while they run, and how to turn them on.
Requests with an optional cost cap refuse paid hosted web search and sandbox execution until the budget ledger covers those costs. Capped requests also skip background memory enrichment; see Memory and Recall.
#Overview
System tools are runtime-provided tools that extend agent capabilities. You allow them with SystemToolsConfig(allowed_tools=[...]):
The runtime offers these tools only when you list them in system_tools_config.
Planning checkpoints (reevaluate) are a separate mechanism that you declare with @depends_on_reevaluate. They are not in the allowlist. Other allowlist names, such as fire_trigger, belong to their own features and guides.
#SystemToolsConfig
Set the config on the scope (Agent(..., system_tools_config=...)) or per call (invoke(..., system_tools_config=...)). A per-call value is merged over the scope value field by field. When a swarm member sets its own config, the platform keeps only the tools both the swarm and the member allow. See Session configuration.
#Built-in Capabilities
Task lists and private workspaces require maivn 2.7.0 or later and a matching deployment.
#Run task list
Add task_list to SystemToolsConfig(allowed_tools=[...]) to let a root invocation publish progress in Studio, Booth, and the SDK event stream. Each update replaces the list with up to 20 items. The agent uses stable IDs, short titles without private details, and the states pending, in_progress, and completed. An empty update clears the list.
A swarm with task_list allowed publishes its plan the same way: one item per member it runs, titled with the member's name, moving from pending to in_progress to completed.
The SDK yields a task_list_updated event once the snapshot is durable. An events(on_event=...) callback and a normalized AppEvent carry the items in different shapes; see Task-list events. The authenticated session event stream can replay it in commit order after a disconnect. Updates belong to one invocation and do not carry over to later turns.
#Private run workspace
An operator can enable private workspaces for authenticated, uncapped invokes with an approved sandbox tariff using MAIVN_DATA_PLANE_SESSION_WORKSPACE_ENABLED. Add the names for one of these modes to SystemToolsConfig(allowed_tools=[...]).
- Use
bashandstr_replace_based_edit_toolfor an offline shell and editor. Bash commands are bounded, and the editor works with regular UTF-8 files of up to 8 KiB. - Use
str_replace_based_edit_tool,workspace_snapshotandworkspace_undofor managed edits with undo. This mode excludes raw Bash because detached shell processes can write outside the editor's revision checks.
Each operation requires the run's ordinary human approval. The first approved file or shell operation creates the workspace. Later operations in the same root use its files, including while a client reconnects to the original running owner. The root's deadline and sandbox tariff bound its lifetime. Cancellation, key revocation and completion close it. A new invoke starts with empty files, and an owner process failure ends access to its workspace.
Snapshots hold an exact file revision for up to 10 minutes within that workspace. Each workspace can keep up to 16 snapshots and 64 KiB of snapshot data. Undo requires the snapshot ID and the current revision returned by the editor. It consumes the snapshot on success. Absolute editor paths must be under /home/user/maivn-workspace, and paths may also be relative to it.
You can add workspace_fetch to either mode when the operator has configured exact domains. The platform fetches UTF-8 HTTPS text, up to 8 KiB per response, without sending ambient credentials or cookies. It checks DNS addresses and each redirect against policy. The guest remains offline. Add domains using the operator's JSON list in MAIVN_DATA_PLANE_WORKSPACE_ALLOWED_DOMAINS.
The Anthropic adapter uses its client Bash and text-editor formats on supported models. The OpenAI Responses adapter uses a custom tool with a Lark grammar for the task list. Both paths still validate tool arguments and apply the platform's approval and receipt rules.
#Datetime Awareness
The mAIvn runtime has built-in datetime awareness. Agents automatically know the current date and time without needing a custom tool. You do not need to create a get_current_time() tool - the system handles this natively.
# No need for this - the system already knows the time:
# @agent.toolify()
# def get_current_time() -> dict: ...
# Just ask directly
response = agent.invoke([
HumanMessage(content='What day of the week is it?')
])This applies to:
- Current date and time
- Timezone information
- Date calculations and comparisons
#Configuring Timezone
When you don't set a timezone, the SDK tries to detect your system's timezone. Detection needs the optional tzlocal package; without it, nothing is detected. You can set the timezone explicitly on the Client:
from maivn import Agent, Client
# Explicit timezone configuration
client = Client(
api_key='your-api-key',
client_timezone='America/New_York', # IANA timezone identifier
)
agent = Agent(name='scheduler', client=client)#Timezone Parameters
#When to Configure Timezone
- Server applications: Set explicit timezone for consistent behavior across deployments
- User-facing apps: Set timezone based on user preferences
- Scheduled tasks: Ensure time-sensitive operations use the correct timezone
# Disable auto-detection, use UTC
client = Client(
api_key='your-api-key',
client_timezone='UTC',
auto_detect_timezone=False,
)
# User-specific timezone
client = Client(
api_key='your-api-key',
client_timezone=user_preferences.timezone,
)The agent sees each message's time in this timezone, once per message, and uses it when answering time-related questions or performing date calculations. When no timezone is set or detected, mAIvn falls back to the deployment timezone and then UTC; see Datetime awareness for the full order.
#Private Data Protection
System-tool calls pass through the runtime's model-input shield: known private values are replaced with placeholders before model-bound prompts are sent, and the request fails closed if a known value remains. This is a defense in depth control, not proof that an arbitrary user string contains no sensitive data.
System tools run only when you list them in allowed_tools. Raw private values are not available to system tools by default. allow_private_data=True is an explicit opt-in for supported flows; use it only after reviewing the destination and the exact tool contract.
#Web Search Privacy
web_search sends its final query to the configured search provider. Known private values are shielded from the model that prepares the call, but you should still treat the query as external disclosure: write prompts that use public terms, inspect representative events in your environment, and never put a secret directly in the search request.
from maivn import SystemToolsConfig
response = agent.invoke(
[HumanMessage(content='Search the public web for account-security guidance.')],
system_tools_config=SystemToolsConfig(allowed_tools=['web_search']),
)#REPL Code Execution Privacy
repl generates Python and runs it in the configured sandbox. The generated code, standard output, and standard error return as tool output. Do not pass private values to it unless the environment supports that flow and you have explicitly enabled it. Keep secrets in your own local tools when a calculation does not need them.
#Think Tool Privacy
think makes a separate model call. Its prompt is protected by the same known-value shield as other model-bound content. Keep allow_private_data off unless a supported workflow truly requires raw values; metadata and placeholders are usually enough.
#Web Search
#Purpose
Search the web for current information, news, or facts.
#How It Works
- The agent determines it needs current information
- The runtime performs the web search
- Search results are returned to the agent
- Agent incorporates results into its response
The model supplies a query and an optional max_results from 1 to 8. If the deployment has no search provider configured, the tool returns a web_search_unavailable error instead of letting the model answer from memory.
#Example Use Case
from maivn import Agent, SystemToolsConfig
from maivn.messages import HumanMessage
agent = Agent(
name='research_agent',
system_prompt='''You are a research assistant.
When asked about current events or recent information,
use web search to find accurate data.''',
api_key='...',
)
response = agent.invoke(
[HumanMessage(content='What are the latest developments in AI?')],
system_tools_config=SystemToolsConfig(allowed_tools=['web_search']),
)With web_search allowed, the model can call it when the request needs current information. A prompt alone does not guarantee a search.
#REPL (Code Execution)
#Purpose
Execute Python code in a secure sandbox.
#How It Works
- Agent generates Python code to solve a problem
- The runtime executes code in an isolated sandbox
- Execution results (stdout, errors) are returned
- Agent interprets results and continues
#Example Use Case
agent = Agent(
name='data_analyst',
system_prompt='''You are a data analyst.
When you need to perform calculations or data analysis,
write Python code and execute it using the REPL.''',
api_key='...',
)
response = agent.invoke(
[HumanMessage(content='Calculate the compound interest on $10,000 at 5% for 10 years')],
system_tools_config=SystemToolsConfig(allowed_tools=['repl']),
)The agent might generate and execute:
principal = 10000
rate = 0.05
years = 10
result = principal * (1 + rate) ** years
print(f"Final amount: ${result:.2f}")#Execution lifetime
Treat each code execution as bounded work. Files, variables and processes are not a supported persistent workspace across invocations. Save outputs through an explicit application storage path when you need them later; do not rely on an earlier sandbox still being available.
#Safety
- Code runs in an isolated sandbox
- No access to host system
- A run is stopped after 90 seconds
- Output is captured and returned
#Think
#Purpose
Run one focused, high-quality reasoning pass over a complex question.
#How It Works
- Agent encounters a complex reasoning task and calls
thinkwith aprompt - The runtime makes a separate model call; choose its model with the
thinkingpart ofModelConfig - The response comes back to the agent as evidence for the next step
#When It's Used
- Interpreting verification results, logs, traces, or conflicting tool outputs
- Evaluating code, architecture, or trade-offs after evidence has been gathered
- Complex mathematical reasoning or multi-step logical deduction
Do not use think for direct lookup, simple arithmetic, trivial summaries, or as a substitute for a dedicated function tool. When think receives prior tool results, its output should preserve failed checks, nonzero return codes, tool errors, and unverified assumptions instead of summarizing them as success.
#System Prompt Guidance
Guide the agent to use system tools appropriately:
#For Research Tasks
agent = Agent(
name='researcher',
system_prompt='''You are a research assistant.
For current information or recent events:
- Use web search to find up-to-date data
- Verify information from multiple sources
For calculations or data analysis:
- Write and execute Python code
- Show your work and explain results''',
api_key='...',
)#For Analysis Tasks
agent = Agent(
name='analyst',
system_prompt='''You are a data analyst.
When analyzing data:
- Use Python code execution for calculations
- Visualize results when helpful
- Explain your methodology
If you discover your initial approach won't work:
- Adjust your analysis plan accordingly''',
api_key='...',
)#Controlling System Tools
The allowlist is the boundary. A system prompt can also steer the model, but it is only guidance:
agent = Agent(
name='calculator',
system_prompt='''You are a simple calculator.
Only use basic arithmetic - do NOT use web search or code execution.
Provide quick mental math answers.''',
api_key='...',
)Pass system_tools_config on the scope or on a call to list the tools a run may use:
from maivn import SystemToolsConfig
response = agent.invoke(
[HumanMessage(content='Research and calculate the result')],
system_tools_config=SystemToolsConfig(
allowed_tools=['web_search', 'repl'],
),
)#Interaction with Your Tools
System tools work alongside your custom tools:
@agent.toolify(description='Get product catalog')
def get_products() -> dict:
return {'products': [...]}
@agent.toolify(final_tool=True)
class MarketReport(BaseModel):
products: list[str]
market_trends: str # May come from web_search
price_analysis: str # May come from repl calculationsWith allowed_tools=['web_search', 'repl'], the agent can:
- Call
get_products(your tool) - Use
web_searchfor market trends - Use
replfor price calculations - Combine all into
MarketReport
#Event Tracing
System-tool activity arrives as system_tool_start, system_tool_chunk and system_tool_complete stream events. Watch them with the event builder:
def show(event: dict) -> None:
print(event['category'], event['event'])
response = agent.events(on_event=show).invoke(
[HumanMessage(content='Research AI trends and analyze market data')],
system_tools_config=SystemToolsConfig(allowed_tools=['web_search', 'repl']),
)See Frontend events for the event shape and filters.
#Privacy Controls and Auditing
#Audit Trail
System-tool lifecycle events show which tool ran and whether it completed. Do not treat an event alone as proof that a query or result contained no sensitive data; test the configured provider and policy boundary with representative non-secret fixtures.
#Final Privacy Boundary
Known registered private values are shielded from model-bound system-tool prompts, and raw private_data is withheld unless you explicitly authorize a supported flow. This boundary does not classify every arbitrary string a user might enter. web_search sends its final query to an external provider, so keep sensitive content out of that query and verify the configured boundary with non-secret fixtures. Runtime events identify system-tool activity without providing a way to retrieve resolved private values.
#Configuration
System tools are still provisioned by the runtime, but developers choose which ones a run may use:
system_tools_config.allowed_toolslists the tools a run may call- Deployment administrators control whether a tool is available at all, such as a search provider for
web_search, plus quotas
Contact your administrator about:
- A tool that is allowed but unavailable
- Rate limits and quotas
#Best Practices
#1. Design for Privacy
agent = Agent(
name='secure_analyst',
system_prompt='''Use web search for public information.
Use REPL only for calculations that do not need customer data.''',
api_key='...'
)
# Private data configuration
agent.private_data = {
'customer_id': '12345',
'api_key': 'sk-xxx-secret'
}#2. Keep Secrets Out of Results
@agent.toolify()
@depends_on_private_data(data_key='secret_key', arg_name='key')
def process_data(data: dict, key: str) -> dict:
result = external_api_call(data, key)
return {
'processed': True,
'result': remove_sensitive_fields(result),
}#3. Combine Privacy Capabilities
# System tools work together while maintaining privacy
@agent.toolify(description='Get user profile')
def get_user_profile(user_id: str) -> dict:
return {'user_id': user_id, 'preferences': [...]}
# Agent can:
# 1. Get profile (your tool)
# 2. Use web_search for public info about preferences
# 3. Use repl for analysis calculations
# 4. Tool results are minimized before returning#4. Verify the Boundary
Use non-secret canary values to verify the configured provider, the event stream and the output paths. Assert that canaries do not appear in captured model requests, search queries, tool results, or user-facing events. Do not use production secrets as test values.
#Next steps
- Agent API - Agent configuration
- Decorators API - Dependency and argument-policy decorators
- Session configuration -
SystemToolsConfigreference - Tools Guide - Custom tool patterns
- Structured Output Guide - Combining with final tools