Core Concepts
Tools
Tools are Python functions decorated with @tool that give agents the ability to take actions - querying APIs, running commands, fetching data, or interacting with external systems.
The @tool decorator turns the function into a Tool with .name, .description, and .get_schema(). It uses the function's type hints and docstring to generate the calling schema the LLM uses to decide when and how to call the tool. Parameters without a default value are treated as required.
Basic (synchronous) tool:
from ncp import tool
@tool
def ping_device(ip_address: str, timeout: int = 5) -> dict:
"""Ping a network device and return whether it is reachable."""
import platform, subprocess
flag = "-n" if platform.system() == "Windows" else "-c"
result = subprocess.run(
["ping", flag, "1", ip_address],
capture_output=True, text=True, timeout=timeout,
)
return {"ip_address": ip_address, "reachable": result.returncode == 0}Asynchronous tool:
@tool
async def backup_device_config(device_ip: str, backup_type: str = "running") -> dict:
"""Asynchronously back up a device configuration."""
import asyncio
# Replace with a real async device/API call in your environment.
await asyncio.sleep(0)
return {"device": device_ip, "backup_type": backup_type, "status": "completed"}Best practices:
Always provide a clear docstring - the LLM uses it to decide when to call the tool.
Use type hints for all parameters.
Return structured data (dict or list) where possible.
Handle errors gracefully within the tool - validate inputs, return a structured error instead of raising, and log where useful:
Agents
Agents combine an LLM with a set of tools to handle tasks autonomously. They are configured with a name, description, instructions, and a list of tools.
Full Agent Reference
Agent supports the following fields:
name
required
Agent name (unique within project)
description
required
Brief description of capabilities
instructions
required
System instructions defining behavior
tools
[]
List of Tool instances (created with @tool)
connectors
[]
Data connector names, resolved by the platform
mcp_servers
[]
List of MCPConfig for external tool servers
llm_config
None
Optional LLMConfig for generation tuning
memory_config
None
Conversation short-term memory strategy
memory_store_enabled
False
Intercept large tool results into the reference store to prevent context overflow
memory_tools_enabled
False
Inject built-in memory tools
memory_context_enabled
False
Inject a table of stored memory entries into the system prompt
ui_components_enabled
False
Attach the UI visualization server (tables, charts, dashboards)
ui_components
None
With UI enabled, None exposes all UI tools; a list restricts exposure to the named tools
max_iterations
None
Cap on the tool-calling loop (platform default applies when unset)
parallel_tool_execution
False
Run multiple tool calls issued in one LLM turn concurrently
hooks
None
AgentHooks for execution observability
handoffs
[]
Agents this agent may transfer the conversation to
max_handoffs
None
Optional cap on handoff transfers within a run
output_key
None
Optional key used to store the agent's output in shared state (multi-agent workflows)
skills
[]
Agent Skill names (resolved at deploy/runtime)
LLM Configuration
LLMConfig tunes generation behavior. Model selection itself is platform-managed (configured per deployment/project), so LLMConfig does not take a model name.
Memory Flags
Two memory systems are controlled from the Agent (see Agent Memory for full detail):
memory_config- manages the conversation context window (short-term memory).memory_store_enabled- keeps large tool results out of the context window by intercepting them into a reference store.memory_tools_enabled- injects built-in memory tools the agent can call.memory_context_enabled- injects a summary table of stored memory entries into the system prompt.
Parallel Tool Execution
When parallel_tool_execution=True, multiple tool calls requested in the same LLM turn run concurrently. Use it when those calls are independent of one another (for example, checking several devices at once).
UI Components
When ui_components_enabled=True, the agent can render UI visualizations. Leaving ui_components=None exposes all available UI tools; providing a list restricts the agent to just those UI tools.
Project Structure
Every NCP SDK agent follows a standard project layout:
apt-requirements.txtis optional - include it only if the agent needs system packages.Files in
knowledge/are ingested into a searchable collection at deployment time (see Knowledge Base Tools).Each skill lives in
skills/<skill-name>/SKILL.mdwith required frontmatter;ncp validatechecks the frontmatter and name (see Agent Skills).
Last updated
