Skip to content

Commit ec6969b

Browse files
authored
Fix/serializable state py (CopilotKit#2177)
1 parent 2126982 commit ec6969b

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

examples/coagents-research-canvas/agent/poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/coagents-research-canvas/agent/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ build-backend = "setuptools.build_meta"
3636

3737
[tool.poetry.dependencies]
3838
python = ">=3.12,<3.13"
39-
copilotkit = "^0.1.56a3"
39+
copilotkit = "^0.1.56a4"
4040
crewai = "0.118.0"
4141
langchain-openai = "0.2.3"
4242
langchain-community = "^0.3.1"

sdk-python/copilotkit/integrations/fastapi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from typing import List, Any, cast, Optional
1010
from fastapi import FastAPI, Request, HTTPException
1111
from fastapi.responses import JSONResponse, StreamingResponse, HTMLResponse
12+
from fastapi.encoders import jsonable_encoder
1213
from ..sdk import CopilotKitRemoteEndpoint, CopilotKitContext
1314
from ..types import Message, MetaEvent
1415
from ..exc import (
@@ -239,7 +240,7 @@ async def handle_info(
239240
result = sdk.info(context=context)
240241
if as_html:
241242
return HTMLResponse(content=generate_info_html(result))
242-
return JSONResponse(content=result)
243+
return JSONResponse(content=jsonable_encoder(result))
243244

244245
async def handle_execute_action(
245246
*,
@@ -255,7 +256,7 @@ async def handle_execute_action(
255256
name=name,
256257
arguments=arguments
257258
)
258-
return JSONResponse(content=result)
259+
return JSONResponse(content=jsonable_encoder(result))
259260
except ActionNotFoundException as exc:
260261
logger.error("Action not found: %s", exc)
261262
return JSONResponse(content={"error": str(exc)}, status_code=404)
@@ -317,7 +318,7 @@ async def handle_get_agent_state(
317318
thread_id=thread_id,
318319
name=name,
319320
)
320-
return JSONResponse(content=result)
321+
return JSONResponse(content=jsonable_encoder(result))
321322
except AgentNotFoundException as exc:
322323
logger.error("Agent not found: %s", exc, exc_info=True)
323324
return JSONResponse(content={"error": str(exc)}, status_code=404)

sdk-python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "copilotkit"
3-
version = "0.1.56-alpha.3"
3+
version = "0.1.56-alpha.4"
44
description = "CopilotKit python SDK"
55
authors = ["Markus Ecker <markus.ecker@gmail.com>"]
66
license = "MIT"

0 commit comments

Comments
 (0)