Table of Contents

Class TeamContext

Namespace
JD.AI.Core.Agents.Orchestration
Assembly
JD.AI.Core.dll

Shared context for a team of agents — provides a thread-safe scratchpad, chronological event stream, and per-agent results collection.

public sealed class TeamContext
Inheritance
TeamContext
Inherited Members

Constructors

TeamContext(string)

public TeamContext(string goal)

Parameters

goal string

Properties

CanNest

Check if we can spawn a deeper subagent.

public bool CanNest { get; }

Property Value

bool

CurrentDepth

Current nesting depth (0 = top-level team).

public int CurrentDepth { get; init; }

Property Value

int

EventCount

Get the count of events recorded.

public int EventCount { get; }

Property Value

int

Goal

The high-level goal this team is working toward.

public string Goal { get; }

Property Value

string

MaxDepth

Maximum subagent nesting depth (default 2).

public int MaxDepth { get; init; }

Property Value

int

Methods

AllCompleted(IEnumerable<string>)

Check if all expected agents have reported results.

public bool AllCompleted(IEnumerable<string> expectedAgents)

Parameters

expectedAgents IEnumerable<string>

Returns

bool

CreateChildContext(string)

Create a child context for a nested team with incremented depth.

public TeamContext CreateChildContext(string childGoal)

Parameters

childGoal string

Returns

TeamContext

GetEventsFor(string)

Get events filtered by agent name.

public IReadOnlyList<AgentEvent> GetEventsFor(string agentName)

Parameters

agentName string

Returns

IReadOnlyList<AgentEvent>

GetEventsSnapshot()

Get all events as a chronological snapshot.

public IReadOnlyList<AgentEvent> GetEventsSnapshot()

Returns

IReadOnlyList<AgentEvent>

GetResult(string)

Get a specific agent's result.

public AgentResult? GetResult(string agentName)

Parameters

agentName string

Returns

AgentResult

GetResultsSnapshot()

Get all results as a read-only snapshot.

public IReadOnlyDictionary<string, AgentResult> GetResultsSnapshot()

Returns

IReadOnlyDictionary<string, AgentResult>

GetScratchpadSnapshot()

Get all scratchpad entries as a read-only snapshot.

public IReadOnlyDictionary<string, string> GetScratchpadSnapshot()

Returns

IReadOnlyDictionary<string, string>

ReadScratchpad(string)

Read a value from the shared scratchpad.

public string? ReadScratchpad(string key)

Parameters

key string

Returns

string

RecordEvent(AgentEvent)

Record an event in the chronological event stream.

public void RecordEvent(AgentEvent agentEvent)

Parameters

agentEvent AgentEvent

RecordEvent(string, AgentEventType, string)

Record an event with auto-timestamp.

public void RecordEvent(string agentName, AgentEventType type, string content)

Parameters

agentName string
type AgentEventType
content string

RemoveScratchpad(string)

Remove a scratchpad entry.

public bool RemoveScratchpad(string key)

Parameters

key string

Returns

bool

SetResult(AgentResult)

Store a completed agent's result.

public void SetResult(AgentResult result)

Parameters

result AgentResult

ToPromptSummary()

Produce a text summary of the team context for injection into prompts.

public string ToPromptSummary()

Returns

string

WriteScratchpad(string, string)

Write a value to the shared scratchpad.

public void WriteScratchpad(string key, string value)

Parameters

key string
value string