Local vs Remote

Choose between local execution and remote deployment based on your development stage and infrastructure requirements.

circle-info

When to use this guide: Reference this when deciding how to run agents during development, testing, or production deployment. Use the decision checklist to pick the right mode for your use case.

Overview

The SDK supports two execution modes:

  • Local Mode โ€” Agents run directly on your machine using the aip-agents library

  • Remote Mode โ€” Agents run on the remote server (via the ai-agent-platform platform, which uses aip-agents internally)

Both modes use the same Agent API, making it easy to switch between them. The SDK (glaip-sdk) can connect to either the platform's remote server or run agents locally using aip-agents directly.

Quick Comparison

Feature
Local Mode
Remote Mode

โš™๏ธ Setup

Install local extra and configure LLM provider key

Install SDK and configure remote API URL/key

๐Ÿ” Credentials

LLM provider key + optional feature keys (memory, NER, tools)

AIP API URL + API key

๐Ÿš€ Deploy Step

No deploy step; run immediately

Deploy first to register agent

๐Ÿ–ฅ๏ธ Execution Location

Runs on your machine

Runs on remote server

๐Ÿง  LLM Provider

Local (via aip-agents)

Platform-managed or custom

Capability Checklist

Capability
Local Mode
Remote Mode

๐Ÿ› ๏ธ Tool calling (custom tools)

โœ…

โœ…

๐Ÿ”— MCP support

โœ…

โœ…

๐Ÿง  Model selection

โœ…

โœ…

๐Ÿงต Token streaming

โœ…

โœ…

๐Ÿงพ Tool output sharing

โœ…

โœ…

๐Ÿค Sub-agent delegation

โœ…

โœ…

๐Ÿง HITL

โœ…

โœ… (audit trail)

๐Ÿ’พ Persistent memory (mem0)

โœ…

โœ…

๐Ÿงฐ Built-in tool: Code Interpreter

โœ…

โœ…

๐Ÿงฐ Built-in tool: Browser Use

โœ…

โœ…

๐Ÿงฐ Built-in tool: Document Loader (PDF, DOCX, Excel)

โœ…

โœ…

๐Ÿ”ง Runtime config overrides

โœ…

โœ…

๐Ÿ•ต๏ธ PII

โœ…

โœ…

๐Ÿ“ Run with file attachments

โœ…

โœ…

๐Ÿ”Œ GL Connectors support

โœ…

โœ…

๐Ÿงฉ Built-in agents (e.g., Data Analyst)

โŒ

โœ…

๐ŸŒ CRUD + Run REST API

โŒ

โœ…

๐Ÿ—‚๏ธ Agent registry (persistent storage)

โŒ

โœ…

๐Ÿ“œ Run history/logs/metrics

โŒ (console only)

โœ…

โฐ Scheduling

โŒ

โœ…

๐Ÿ“ก Offline execution

โœ…

โŒ

Local Mode

Setup

The [local] extra includes aip-agents for local LLM execution.

Usage Pattern

Local Run Examples

All local features assume a configured LLM provider key (for example OPENAI_API_KEY). Additional required environment variables are listed per feature below.

Example .env (include only what you use):

Feature
Required env vars
Example

Basic run

None beyond LLM provider key

Files (files=[...])

None beyond LLM provider key

Built-in tool: Document Loader (PDFReaderTool, DocxReaderTool, ExcelReaderTool)

None beyond LLM provider key

Native aip-agents tools (web search, code sandbox, browser use)

SERPER_API_KEY (GoogleSerperTool), E2B_API_KEY (E2BCodeSandboxTool); other tools may require their own env

mem0 memory

MEM0_API_KEY or GLLM_MEMORY_API_KEY

PII toggle (enable_pii)

Optional NER_API_URL and NER_API_KEY for NER-backed masking

Tool output sharing (agent_config.tool_output_sharing)

None beyond LLM provider key

Runtime config overrides

ARXIV_MCP_API_KEY and ARXIV_MCP_AUTH_TOKEN (optional, for Arxiv MCP)

Definition-time configs (tool_configs, mcp_configs, agent_config)

ARXIV_MCP_API_KEY and ARXIV_MCP_AUTH_TOKEN (optional, for Arxiv MCP)

HITL (hitl_enabled)

None beyond LLM provider key

Chat history input

None beyond LLM provider key

Sub-agents

None beyond LLM provider key

MCPs with local transport

ARXIV_MCP_API_KEY and ARXIV_MCP_AUTH_TOKEN (optional, for Arxiv MCP)

GL Connectors

GL_CONNECTORS_BASE_URL, GL_CONNECTORS_API_KEY, GL_CONNECTORS_USERNAME, GL_CONNECTORS_PASSWORD; optional GL_CONNECTORS_IDENTIFIER

Tool Output Sharing Quickstart (Local)

The hello-world-local project ships with main_with_tool_output_sharing.py, which wires two LangChain-compatible tools together and enables $tool_output.<call_id> references through agent_config={"tool_output_sharing": True}. Use this path when you want to stage multi-step tool workflows locally before promoting them to the remote platform.

circle-info

Monitor the console output when running locally. Each tool call prints a call_id so you can trace which stored output is being replayed.

  1. Install dependencies: pip install "glaip-sdk[local]" (includes aip-agents).

  2. Copy .env.example from python/gl-agents/projects/hello-world-local and set OPENAI_API_KEY.

  3. Run python main_with_tool_output_sharing.py to watch the agent perform a two-step greeting workflow with shared tool responses.

The script prints both the intermediate explanation (including the call_id reference) and the final formatted greeting, mirroring the same workflow you would deploy remotely once satisfied with the run.

Remote Mode

Remote mode connects to the platform's remote server, which uses aip-agents internally to execute agents.

Setup

Usage Pattern

Switching Between Modes

Best practice: Use instances instead of strings for seamless migration between modes.

Local Override for Deployed Agents

You can force local execution for an agent that has already been deployed to the remote server by passing local=True to run() or arun().

circle-info

When local=True is used, the SDK behaves exactly as if the agent was not deployed, requiring the [local] extra and local LLM credentials.

Seamless Migration Example

circle-exclamation

Migration Path: Local โ†’ Remote

  1. Test locally with agent.run() (uses aip-agents directly)

  2. Configure AIP server credentials (AIP_API_URL, AIP_API_KEY)

  3. Add deploy() call before first remote run

  4. Verify remote run with same inputs

Migration Path: Remote โ†’ Local

  1. Install local extra: pip install "glaip-sdk[local]" (includes aip-agents)

  2. Set OPENAI_API_KEY environment variable

  3. Remove deploy() calls from code (not needed for local execution)

  4. Replace string/native references with instances if any exist

Decision Checklist

Use Remote Mode (AIP server) if you need any capability that is remote-only (โœ… on Remote, โŒ on Local). Otherwise, use Local Mode (aip-agents directly).

Common Patterns

Pattern 1: Local Development, Remote Production

Pattern 2: Conditional Mem0 Usage

Pattern 3: Testing Locally, Running on Remote

Troubleshooting

Issue
Local Mode
Remote Mode

Agent not found

N/A (ephemeral)

Check aip agents list

Missing dependencies

Install glaip-sdk[local] (includes aip-agents)

Upload tools to AIP server

Authentication error

N/A

Verify AIP_API_KEY for AIP server

Memory not persisting

Check MEM0_API_KEY and agent_config.memory

Check agent_config.memory and AIP server mem0 setup

Slow execution

Check local LLM config

Check network latency to remote server

Last updated