Portal Community

Scope Levels

ScopeAgentIdIsSharedVisible To
Agent-PrivateSpecific agent IDfalseOnly the owning agent
Tenant-SharednulltrueAll agents in the tenant

When to Use Shared Procedures

Use shared (tenant-level) procedures for tasks that multiple domain agents might need to perform:

Setting Scope in agents-app

// When creating a procedure via API:
POST /api/octopus/procedures
{
  "name": "user_identity_lookup",
  "description": "Look up a user by name or email",
  "triggerPattern": "look up user|find employee|who is",
  "agentId": null,         // null = shared
  "isShared": true,
  "steps": [...]
}

// Agent-private procedure:
{
  "name": "vendor_onboarding",
  "agentId": "5e7d3a1b-...",  // specific agent
  "isShared": false,
  "steps": [...]
}

Precedence Rule

When both an agent-private and a tenant-shared procedure match the same trigger pattern, the agent-private procedure takes precedence. This allows agents to override shared procedures with domain-specific behavior:

// FindMatchAsync precedence:
var agentMatch = procedures.FirstOrDefault(
    p => p.AgentId == agentId && p.IsApproved && Regex.IsMatch(task, p.TriggerPattern));

if (agentMatch != null) return agentMatch;   // agent-private wins

var sharedMatch = procedures.FirstOrDefault(
    p => p.IsShared && p.IsApproved && Regex.IsMatch(task, p.TriggerPattern));

return sharedMatch;   // fallback to shared
Shared Procedure Changes Affect All Agents

Editing a tenant-shared procedure immediately affects all agents that use it. Test changes carefully using the trigger pattern tester before saving. Consider creating an agent-private override for one agent first to validate the new behavior before applying it tenant-wide.