When Anthropic models return multi-part content lists, only the first
element was used and the rest discarded. Now iterates all parts and
concatenates text blocks, preserving the full message content.
LangGraph 1.x can return string or dict resume values from interrupt(),
not just lists. The code now type-checks the response: strings are
returned directly, dicts are JSON-serialized, and lists use the
existing [-1].content path.
Sequential emit_state calls with different keys now preserve all keys
in the snapshot. Previously, each call would replace the entire
manually_emitted_state, losing keys from earlier calls.
- Add TestAGUIStyleEventIntegration to test_agui_agent.py: proves that AG-UI-style
unprefixed events (manually_emit_message, manually_emit_tool_call, exit) flow
correctly through CopilotKit's _handle_single_event to the AG-UI base handler
without being suppressed or double-converted by the CopilotKit layer.
- Replace LangGraphAgent with LangGraphAGUIAgent in both example files
(canvas/gemini and v1/_legacy/saas-dynamic-dashboards) to close the concern
about removed APIs still being referenced externally.
- Update poetry.lock to reflect ag_ui_langgraph 0.0.32 and dependency updates.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Expands test suite for LangGraphAGUIAgent:
- TestLanggraphDefaultMergeState: verify no duplicates in copilotkit.actions
and that tool ordering is preserved in the merged result
- TestReasoningContentPreservation: verify unknown custom events pass through,
empty-string messages still emit the full TEXT_MESSAGE_* sequence, and
empty-args tool calls still emit the full TOOL_CALL_* sequence
Expands test suite for emit filtering:
- TestMissingOrNoneRawEvent: events with rawEvent=None should pass through
to super() without crashing
- TestNoneEmitMetadataValues: None and 0 values for emit metadata keys
should NOT filter (only exactly False suppresses events)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
No longer needed now that LangGraphAgent is gone — the only caller was
the deprecated agent class. Also removed from langchain.py re-exports.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ran confirmed LangGraphAGUIAgent is the only relevant path going forward.
Removes LangGraphAgent, _StreamingStateExtractor, CopilotKitConfig, and
langgraph_default_merge_state from sdk-python (the AG-UI base class
provides this now). Also removes the use_function_call=True code path
from copilotkit_messages_to_langchain (no callers, function_call format
is obsolete).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add copilotkit.a2ui module with operation builders and prompt helpers,
fix SystemMessage ID reuse in before_agent to prevent LangGraph duplication,
add Pydantic model_dump serialization for app_context.
- Python SDK: 18 new tests for LangGraphAGUIAgent (custom event handling,
emit filtering, state merging, copilotkit namespace)
- TypeScript SDK: 25 new tests for copilotkitCustomizeConfig and
convertActionsToDynamicStructuredTools
- TypeScript Runtime: 27 new tests for event-source helpers
(shouldEmitToolCall, getCurrentMessageId, getCurrentContent, etc.)
- TypeScript Runtime: expanded dispatch-event-filtering tests with
custom event dispatch (manually_emit_message/tool_call/state, exit)
and langGraphDefaultMergeState tests
- Dead code annotations: LangGraphAgent class and use_function_call=True
branch annotated with TODO(ran-review) for Ran to verify
https://claude.ai/code/session_01BPMn7zhadhapfyyD8kYeAH
Replace eslint and prettier with oxlint and oxfmt for faster linting
and formatting across the monorepo. Remove all eslint and prettier
configs, dependencies, and related packages. Add .oxlintrc.json and
.oxfmtrc.json for the new tooling. Update CI workflows and lefthook
hooks accordingly. Reformat codebase with oxfmt.
https://claude.ai/code/session_01GMkSf29p78HuMR1mbXn8He
The re module was used in _fix_messages_for_bedrock (re.compile) but
never imported, causing NameError at runtime when the middleware is
invoked. Bumps version to 0.1.83.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add _fix_messages_for_bedrock() to handle three issues caused by
after_agent restoring frontend tool_calls to the checkpoint:
1. Strip unanswered tool_calls without matching ToolMessages (Bedrock
rejects toolUse without a corresponding toolResult)
2. Sync msg.content tool_use blocks with msg.tool_calls
3. Fix tool_use/tool_call blocks with string input/args (must be dict)
Avoid emitting spurious empty assistant messages for tool-call-only
AIMessages (common with OpenAI models where content is empty string).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
langchain_messages_to_copilotkit previously skipped creating the assistant
message when an AIMessage had tool_calls, causing missing context in chat
history on reconnect. Also adds ActionExecutionMessage type guard in
copilotkit_messages_to_langchain to prevent KeyError on non-tool messages
with parentMessageId.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
## Problem
The Poetry caret constraint `^0.115.0` in `sdk-python/pyproject.toml`
resolves to `>=0.115.0,<0.116.0` for 0.x versions (per [PEP 440 / Poetry
docs](https://python-poetry.org/docs/dependency-specification/#caret-requirements)).
This blocks installation alongside any FastAPI release since **0.116.0
(June 2025)**.
Current stable FastAPI is **0.129.0** — 14 minor versions ahead of the
ceiling.
## Impact
- Cannot `pip install copilotkit` in any project using FastAPI >=0.116.0
- Multiple users blocked (see #2771 comments)
- Our production project has **~90 tests bypassed** with
`COPILOTKIT_AVAILABLE = False` guards because of this
## Fix
```diff
- fastapi = "^0.115.0"
+ fastapi = ">=0.115.0,<1.0.0"
```
This allows all current and future 0.x FastAPI releases while still
capping at the upcoming 1.0 major version boundary, which may introduce
breaking changes.
## Testing
- The SDK uses standard FastAPI features (routing, dependency injection,
middleware) that have been stable across all 0.11x–0.12x releases
- No FastAPI APIs used by the SDK were deprecated or removed in
0.116.0–0.129.0
- `ag-ui-langgraph` (also in deps) uses `>=0.115.0` without an upper
bound, so this change aligns the two constraints
## Note on `ag-ui-langgraph`
`ag-ui-langgraph[fastapi]` also depends on FastAPI. Its constraint is
already `>=0.115.0` (no ceiling), so this change to `copilotkit` is the
only fix needed.
Fixes#2771
Tests the two bugs fixed in this PR:
1. Dict raw_event metadata must be read with .get(), not getattr()
2. Filtered events must return None (not ""), and run() strips them
Adds pytest as a dev dependency.
Fixes#2066
## Problem
`copilotkit_customize_config(config, emit_messages=False)` does not work -
TEXT_MESSAGE_* events are still emitted despite the configuration.
## Root Causes
1. **Metadata Reading Bug**: In `langgraph_agui_agent.py`, the code uses
`getattr(raw_event, 'metadata', {})` to read metadata, but `raw_event`
is a dict, not an object. This should use `.get()` instead.
2. **Encoder Crash Bug**: When the filtering logic works (after fixing bug #1),
it returns `""` (empty string) to skip dispatching events. However, this
empty string gets yielded to the event encoder which expects event objects
with `model_dump_json()` method, causing an `AttributeError`.
## Fixes
1. Changed metadata reading to handle both dict and object cases.
2. Changed return value from `""` to `None` for filtered events.
3. Added `run()` method override to filter out `None` values before yielding
to encoder.
The Poetry caret constraint `^0.115.0` resolves to `>=0.115.0,<0.116.0` for
0.x versions, blocking installation alongside any FastAPI release since 0.116.0
(June 2025). This prevents adoption of the Python SDK in projects using current
FastAPI versions.
Change to `>=0.115.0,<1.0.0` to allow all 0.x releases while still capping
at the upcoming 1.0 major version boundary.
Fixes#2771
Adds missing dict_repr() method to LangGraphAGUIAgent class to fix
AttributeError when SDK tries to serialize agent info.
The method was present in the parent LangGraphAgent class but not
overridden in LangGraphAGUIAgent, causing failures when calling
sdk.info() with AGUI agents in FastAPI integrations.
Fixes#2667