Skip to content

Concurrent Execution of Multiple Instances

When verifying multiple DUTs simultaneously, give each instance a separate workspace, state directory, and listening port. This keeps their .ucagent/, ut_project/, and MCP endpoints independent.

1. Select Execution Mode

Mode Model Connection Suitable Scenario
Standard Mode Concurrent Each UCAgent uses the LangChain backend Running multiple tasks locally via script or tmux
Command-line Backend Concurrent Each instance uses an independent MCP port and invokes the Code Agent Tasks requiring an external Agent
Master A single Master manages multiple sub-Agents Centralized scheduling, queueing, and web monitoring requirements

Running multiple instances simply splits tasks; it does not alter the stages or Checker semantics of individual tasks.

2. Standard Mode: Independent Workspaces

Prepare a separate ToffeeUT workspace for each DUT as shown in Normal Mode:

1
2
3
4
5
workspaces/
├── adder/
│   └── Adder/          # RTL and specification
└── mux/
    └── Mux/

Start them separately:

ucagent toffee-ut workspaces/adder Adder --backend langchain --tui --loop
ucagent toffee-ut workspaces/mux Mux --backend langchain --tui --loop

Each task writes to its own ut_project/. Production scripts should record the PID, log path, and exit code for each task.

3. MCP/Code Agent Concurrent Execution

Built-in CLI backends allocate a private session directory and MCP endpoint for each task.

Example:

1
2
3
4
5
ucagent toffee-ut workspaces/adder Adder \
  --backend opencode --tui --loop

ucagent toffee-ut workspaces/mux Mux \
  --backend opencode --tui --loop

If you launch clients separately, add --mcp-server --mcp-server-port -1 to each instance and connect to its assigned MCP port.

4. Managing Sessions with tmux

You can place each instance in a separate tmux pane:

tmux new-session -d -s ucagent_multi

tmux send-keys -t ucagent_multi:0.0 \
  'ucagent toffee-ut workspaces/adder Adder --tui --loop' C-m

tmux split-window -h -t ucagent_multi:0.0
tmux send-keys -t ucagent_multi:0.1 \
  'ucagent toffee-ut workspaces/mux Mux --tui --loop' C-m

tmux attach-session -t ucagent_multi

Do not rely on a fixed sleep 10 to determine if a task is ready; use logs, port checks, or Agent status confirmation. When stopping, terminate the corresponding process in the pane first, then close the tmux session.

5. Master Multi-Tasking

When the number of tasks is large, start a Master and let the Launch page create an independent workspace for each task, then launch sub-Agents via process, Docker, Docker Swarm, or Kubernetes. The Master's master_api.max_task_count controls the number of concurrent tasks; exceeding this limit puts tasks into a waiting queue.

The Master is suitable for centralized status and log viewing; tasks should still use independent outputs, ports, and client configurations. See Master Mode and Web Master Usage Guide for more details.

6. Troubleshooting

  • Port Conflict: Assign a different --mcp-server-port to each MCP Server, or use -1 to auto-select a port, and write the actual port to the client configuration.
  • Artifacts Overwriting: Check if the workspace, --output, .ucagent/, and client configuration directory are independent.
  • Task Stuck in Waiting: Check the Master's concurrency limit and Launch Queue; in standard mode, check processes, logs, and model API rate limits.
  • Client Cannot Connect: Confirm that UCAgent has started with the corresponding MCP parameters, the client uses the /mcp endpoint, and the host/port match the permissions.

See Batch Execution for batch processing and hook-driven unattended workflows; it is not recommended to copy unverified client-specific scripts from this page.