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
goalstring
Properties
CanNest
Check if we can spawn a deeper subagent.
public bool CanNest { get; }
Property Value
CurrentDepth
Current nesting depth (0 = top-level team).
public int CurrentDepth { get; init; }
Property Value
EventCount
Get the count of events recorded.
public int EventCount { get; }
Property Value
Goal
The high-level goal this team is working toward.
public string Goal { get; }
Property Value
MaxDepth
Maximum subagent nesting depth (default 2).
public int MaxDepth { get; init; }
Property Value
Methods
AllCompleted(IEnumerable<string>)
Check if all expected agents have reported results.
public bool AllCompleted(IEnumerable<string> expectedAgents)
Parameters
expectedAgentsIEnumerable<string>
Returns
CreateChildContext(string)
Create a child context for a nested team with incremented depth.
public TeamContext CreateChildContext(string childGoal)
Parameters
childGoalstring
Returns
GetEventsFor(string)
Get events filtered by agent name.
public IReadOnlyList<AgentEvent> GetEventsFor(string agentName)
Parameters
agentNamestring
Returns
GetEventsSnapshot()
Get all events as a chronological snapshot.
public IReadOnlyList<AgentEvent> GetEventsSnapshot()
Returns
GetResult(string)
Get a specific agent's result.
public AgentResult? GetResult(string agentName)
Parameters
agentNamestring
Returns
GetResultsSnapshot()
Get all results as a read-only snapshot.
public IReadOnlyDictionary<string, AgentResult> GetResultsSnapshot()
Returns
GetScratchpadSnapshot()
Get all scratchpad entries as a read-only snapshot.
public IReadOnlyDictionary<string, string> GetScratchpadSnapshot()
Returns
ReadScratchpad(string)
Read a value from the shared scratchpad.
public string? ReadScratchpad(string key)
Parameters
keystring
Returns
RecordEvent(AgentEvent)
Record an event in the chronological event stream.
public void RecordEvent(AgentEvent agentEvent)
Parameters
agentEventAgentEvent
RecordEvent(string, AgentEventType, string)
Record an event with auto-timestamp.
public void RecordEvent(string agentName, AgentEventType type, string content)
Parameters
agentNamestringtypeAgentEventTypecontentstring
RemoveScratchpad(string)
Remove a scratchpad entry.
public bool RemoveScratchpad(string key)
Parameters
keystring
Returns
SetResult(AgentResult)
Store a completed agent's result.
public void SetResult(AgentResult result)
Parameters
resultAgentResult
ToPromptSummary()
Produce a text summary of the team context for injection into prompts.
public string ToPromptSummary()
Returns
WriteScratchpad(string, string)
Write a value to the shared scratchpad.
public void WriteScratchpad(string key, string value)