Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a large PR that restructures the entire orchestration backend without touching the user-facing objects.
Pipeline:
Controller
object is created. The Controller is given a few parameters (the tasks to complete, the agents assigned, a flow) and its job is to orchestrate resources to achieve those goalsready
to runAgentContext
consisting of the agent itself, the agent's assigned tasks, and a sequence of events relevant to those tasksThe key to this backend is that all activity is recorded as a sequence of events that can optionally be persisted. These events represent everything that's happened in the workflow. When it's time to run an agent, we compile the events into LLM messages appropriate for that agent. For example, that agent's own responses are given the
assistant
role, and other agents' responses are given theuser
role with asystem
preamble explaining who the speaker is. Anecdotally this is far superior to the current approach in which all agents share theassistant
role.In addition, the compilation only includes events that are relevant to the agent's current objective. This means that if an agent is selected to work on task A, and in the next invocation a different agent is selected to work on task B, and A and B are completely independent, then the second agent will not be shown any of the first agent's responses, because they have no bearing on its work.
In essence, we compile a specialized view of the workflow universe for every agent invocation.
TODO: