agents 2.0.0
agents: ^2.0.0 copied to clipboard
Dart port of the Microsoft Agents AI framework. Build, compose, and orchestrate AI agents backed by any ChatClient — with sessions, streaming, tool use, compaction, evaluation, and middleware pipelines.
Changelog #
2.0.0 #
- Breaking:
streamAsyncandresumeStreamAsyncnow return a live run. Both used to drive the workflow to quiescence before returning, so the returnedStreamingRunwas already finished and itsoutgoingEventswas complete. They now return as soon as the run is open and drive it in the background. Observe progress withStreamingRun.watchStreamAsync(); readingoutgoingEventsimmediately after the await yields only the events produced so far. External responses sent viasendResponseAsync(and messages viatrySendMessageAsync) resume the run.- In
ExecutionMode.offThread(the default) every event is published the moment it is created, including outputs yielded part-way through an executor invocation — streamed agent updates now surface live. InExecutionMode.lockstepevents are still batched and published together after each superstep. watchStreamAsyncreplays the events already recorded before switching to the live tail, so a watcher that subscribes late — even after the run has ended — still observes the full sequence.- Added
StreamingRun.isCompleted.
- In
- Breaking: external responses route by request, not by payload type.
addExternalResponsepreviously completed the request and then handed the payload to the first executor whose input type accepted it. It now resolves the pendingExternalRequestbyrequestId(searching joined sub-workflow runners too) and delivers the response to the executor that issued it. It throws aStateError— leaving pending requests untouched — when the request id is unknown, already serviced, or the issuing executor does not accept the payload type. Workflows that relied on the old loose matching must respond with theExternalRequestsurfaced by the run'sRequestInfoEvent.ExternalRequestgainedsourceExecutorId, recording the issuing executor.
WorkflowContext.sendRequestnow returnsExternalResponse.pending, an explicit placeholder, instead of forcingnullintoTResponse. Readingresponseon a placeholder throws aStateErrornaming the request and port rather than failing with an opaque cast error; the real response arrives as a message in a later superstep.- Added
WireMarshaller.valueConverters, a registry ofWireValueConverters keyed by payload type id. Checkpointing serializes pending message payloads to JSON text, which fails for payloads outside the JSON model (chat messages, for example); hosts can now register a converter to serialize and revive those types. AsyncRunHandleserializes concurrent drive passes, so a caller that delivers a message or response while a drive is in flight waits for the queued work to be processed. A failure in the initial background drive is now reported as aWorkflowErrorEventand ends the run instead of leaving stream observers waiting forever.- Breaking: requires
extensions: ^0.6.0, which changes AI function invocation. ReachingmaximumIterationsPerRequestnow issues one more provider call with function declarations withheld so the model produces a real answer, instead of returning unanswered tool calls; exceedingmaximumConsecutiveErrorsPerRequestnow throws (a single failure rethrown as-is, several combined into anAggregateException) instead of returning a partial response; and the limit comparison changed from>=to>, so a limit of0surfaces the first tool failure immediately. Also inheritsAIContent.annotationsand the completed OpenTelemetry decorator set. - Breaking: requires
anthropic_sdk_dart: ^6.0.0. Its types appear in this package's public API (AnthropicChatClient.clientand theAnthropicClientbuilder extensions), so dependents pinning the SDK directly must move to 6.x as well. - Verified against the current releases of the unchanged constraints, notably
mcp_dart2.4.0.
1.6.0 #
- Add live shell output reporting:
ShellExecutor.outputEventsbroadcasts typedShellOutputChunkvalues while commands run, local and Docker options accept anonOutputcallback, and persistent shell sessions now capture stderr instead of discarding it.
1.5.0 #
- Add
AnthropicChatClientunderanthropic/: aChatClientbacked by Anthropic's Messages API, with client builder extensions and shared defaults. - Add
GeminiChatClientandGeminiClientundergemini/: aChatClientbacked by the Gemini API, with builder extensions and defaults. HandlesthoughtSignatureround-tripping on function calls (including the documented skip-validation placeholder for replayed calls), strips unsupportedadditionalPropertiesfrom tool and response schemas, and enables server-side tool invocations when mixing Gemini built-in tools with function tools. - Add MCP integration under
mcp/:AgentMcpSkillsSourcediscovers Agent Skills exposed over MCP (AgentMcpSkill,McpSkillIndex,AgentMcpSkillResource, plus options),McpClientTaskExtensionsexposes MCP tools as AI functions (McpClientAIFunction,TaskAwareMcpClientAIFunction,McpTaskOptions), and the skills provider builder gains MCP registration extensions. - Add sequential and concurrent orchestrations to the workflows engine:
SequentialWorkflowBuilderandConcurrentWorkflowBuilderon the sharedOrchestrationBuilderBase, withOutputTag(+ JSON converter),WorkflowOutputEventextensions, and checkpoint support for output executors inWorkflowInfo. - Add session-store composition under
hosting/:DelegatingAgentSessionStore,IsolationKeyScopedAgentSessionStore(+ options), andSessionIsolationKeyProviderfor partitioning stored sessions by user, tenant, or composite keys. - Expand OpenAI hosting:
HostedAgentResponseExecutorroutes Responses API requests to hosted agents byagent.nameormetadata["entity_id"], withOpenAIResponseRequestInfo/OpenAIChatCompletionRequestInforequest descriptors, per-API map options,AgentReference, and standardized response error codes. - Add OpenAI conversion helpers under
ai/open_ai/: extensions mappingAgentResponseandChatClientAgentresults onto OpenAI wire formats. - Add auto-approval rules to the tool-approval middleware:
ToolApprovalAgentOptionswith orderedautoApprovalRules(evaluated after standing rules, before prompting the user) and an approve-all rule. - Expand the file access and file memory providers: new
replaceandreplace_linesediting tools backed by the sharedFileEditor/FileLineEdithelpers,FileStoreEntrymetadata, configurable tool names, and read-only / full auto-approval rule presets. - Add chat-client decorators:
MessageInjectingChatClientlets external code (such as tool delegates) enqueue messages into the function invocation loop, andNonApprovalRequiredFunctionBypassingChatClientstrips approval requests for tools that do not require approval, re-injecting them pre-approved on the next request. - Add
BackgroundTaskCompletionLoopEvaluator(+ options): keeps aLoopAgentiterating until tracked background tasks complete, with a templated feedback message listing the still-running tasks. - Add skills improvements: a
CachingAgentSkillsSourcedecorator (+ options),AgentSkillsSourceContext, andAgentFileSkillFilterContextfor filtering file-based skills. - Add evaluation types:
GeneratedEvaluatorRef(versioned references to generated evaluators) andRubricScore(typed per-dimension score breakdown for rubric evaluators). - Export
InvokedContextandInvokingContextas standalone libraries (previously hidden from the public API) and publicly exportChatMessageJsonConverter. - Fix
AIContextProvider.getServiceto resolve requests for concrete provider types (matching theruntimeTypeidiom used byAgentSessionandDelegatingAIAgent); concrete-type lookups previously returnednull, breaking provider resolution inBackgroundTaskCompletionLoopEvaluatorandTodoCompletionLoopEvaluator. - Add
anthropic_sdk_dart: ^5.0.0,archive: ^4.0.9,http: ^1.6.0, andmcp_dart: ^2.2.1dependencies; bumpextensionsto^0.5.0.
1.4.0 #
- Add loop agents under
harness/loop/:LoopAgentandLoopAgentOptionsrun an inner agent repeatedly until an evaluator signals completion, with pluggableLoopEvaluatorstrategies —AIJudgeLoopEvaluator,CompletionMarkerLoopEvaluator,TodoCompletionLoopEvaluator, andDelegateLoopEvaluator— plusLoopContext,LoopEvaluation, andJudgeVerdictsupport types. - Add Magentic multi-agent orchestration to the workflows engine:
MagenticWorkflowBuilder,MagenticOrchestrator, the plan-review request/response messages, and the progress ledger (ports the upstream Magentic manager/orchestrator pattern). - Add OpenAI-compatible hosting under
hosting/open_ai/: shelf-based routers and handlers for the Chat Completions, Conversations, and Responses APIs, backed by in-memory storage, exposed throughopen_ai_hosting_service_collection_extensions. - Add
shelf: ^1.4.0andshelf_router: ^1.1.0dependencies for the OpenAI hosting routers. - Fix fan-in edges losing buffered messages across checkpoint/resume: pending
fan-in contributions are now captured in
Checkpoint.fanInStateand restored on resume (both the in-proc and legacy execution engines). Old checkpoint JSON without the field remains loadable. - Fix fan-in edges dropping all but the last message from a source that sent
more than once before the edge released; all buffered messages are now
delivered, ordered by source then arrival (matches upstream
FanInEdgeStatesemantics). - Fix streamed responses losing
responseId,messageId,createdAt,usage,modelId,rawRepresentation, andadditionalPropertieswhen coalesced byChatClientAgentandPerServiceCallChatHistoryPersistingChatClient; all call sites now share onetoChatResponse()extension (ports C#ToChatResponse). - Fix
A2AAgentSession.serialize()dropping the sessionstateBag; it now round-trips, and legacy payloads without it remain loadable. - Remove the unused
StatefulEdgeRunnerinterface (breaking; it had no implementors — fan-in state is checkpointed viaCheckpoint.fanInState). - Rename
agent_response_t_.dart→agent_response_of.dartandprovider_session_state_t_state_.dart→provider_session_state.dart(library paths only; type names unchanged). - Simplify shell executor timeout handling with a shared
waitForProcessExithelper; removes an unmanaged kill timer and ensures the force-kill is awaited before draining output.
1.2.0 #
- Add A2A (Agent-to-Agent) protocol support:
- Client-side
A2AAgent,A2AAgentOptions,A2AAgentSession, andA2AContinuationTokenfor consuming remote agents over the A2A protocol. a2a_client_extensionsanda2a_agent_card_extensionshelpers.- Server-side hosting bridge:
A2AAgentHandler,A2ARunDecisionContext,A2AServerRegistrationOptions,agentRunMode, thea2a_server_service_collection_extensionsregistration helpers, and aMessageConverter.
- Client-side
- Add
a2a: ^4.2.0dependency.
1.1.0 #
- Previous release.