MIT License

项目介绍

CopilotKit/scene-creator-copilot 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 160 个 Star、35 次 Fork。

仓库全名
CopilotKit/scene-creator-copilot
开源许可证
MIT License
Star 数
160
Fork 数
35

README 摘要

Scene Creator - CopilotKit + LangGraph + Gemini 3 Demo A demo app showcasing CopilotKit integration with LangGraph and Google's Gemini 3 models. Generate AI-powered scenes by creating characters, backgrounds, and combining them together. https://github.com/user-attachments/assets/3c60c2b8-5ccd-42f0-817f-0e5e22398a48 What This Demo Shows CopilotKit + LangGraph Integration - Connect a Python LangGraph agent to a…

完整内容见 GitHub 原始 README 或本页 。

常见问题

scene-creator-copilot 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 160 个 Star。

scene-creator-copilot 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 scene-creator-copilot 的源码?

可以直接克隆仓库:git clone https://github.com/CopilotKit/scene-creator-copilot.git,默认分支为 main;安装与运行步骤见仓库 README。

scene-creator-copilot 最近还在维护吗?

仓库最近一次更新为 5月27日,当前没有未关闭的 Issue;Star 数为 160,可作为社区活跃度的参考。

简要分析

热度分
230
价值分
106
活跃状态
归档

语言占比

CSS
Dockerfile
JavaScript
Python
TypeScript

README

Scene Creator - CopilotKit + LangGraph + Gemini 3 Demo

A demo app showcasing CopilotKit integration with LangGraph and Google’s Gemini 3 models. Generate AI-powered scenes by creating characters, backgrounds, and combining them together.

https://github.com/user-attachments/assets/3c60c2b8-5ccd-42f0-817f-0e5e22398a48

What This Demo Shows

  • CopilotKit + LangGraph Integration - Connect a Python LangGraph agent to a Next.js frontend
  • Shared State Pattern - Bidirectional state sync between frontend and agent
  • Human-in-the-Loop (HITL) - Approve/reject AI actions before execution
  • Generative UI - Real-time tool execution feedback in chat
  • Dynamic API Keys - Pass API keys from frontend to agent at runtime
  • Image Generation - Using Gemini 3 and Nano Banana (gemini-2.5-flash-image)

Demo Features

Feature Description
Character Generation Create characters with AI-generated images
Background Generation Generate environments and scenes
Scene Composition Combine characters and backgrounds
Image Editing Modify generated images with natural language
HITL Approval Review and approve image prompts before generation

Quick Start

Prerequisites

Setup

# 1. Install dependencies
npm install

# 2. Set up your API key
echo 'GOOGLE_API_KEY=your-key-here' > agent/.env

# 3. Start the app
npm run dev

Open http://localhost:3000 and start creating!

Project Structure

├── src/
│   ├── app/
│   │   ├── page.tsx          # Main UI with CopilotKit integration
│   │   └── api/copilotkit/   # CopilotKit API route
│   ├── components/
│   │   ├── ArtifactPanel.tsx # Display generated artifacts
│   │   ├── ApiKeyInput.tsx   # Dynamic API key management
│   │   └── CustomChatInput.tsx
│   └── lib/
│       └── types.ts          # Shared TypeScript types
├── agent/
│   ├── agent.py              # LangGraph agent with tools
│   ├── server.py             # Custom routes (static files)
│   └── langgraph.json        # LangGraph configuration

Key CopilotKit Patterns

1. Shared State (Frontend ↔ Agent)

// Frontend: src/app/page.tsx
const { state, setState } = useCoAgent<AgentState>({
  name: "sample_agent",
  initialState: { characters: [], backgrounds: [], scenes: [] },
});

// Update state from frontend
setState((prev) => ({ ...prev, apiKey: newKey }));
# Agent: agent/agent.py
class AgentState(MessagesState):
    characters: List[dict] = []
    backgrounds: List[dict] = []
    scenes: List[dict] = []
    apiKey: str = ""

# Read state in agent
api_key = state.get("apiKey", "")

2. Human-in-the-Loop (HITL)

// Frontend: Enable HITL for specific tool
useCopilotAction({
  name: "approve_image_prompt",
  disabled: true,  // Agent calls this, not user
  handler: async ({ prompt }) => {
    // Show approval UI, return approved/rejected
  },
});

3. Generative UI

// Show real-time tool progress
useCopilotAction({
  name: "create_character",
  render: ({ status, result }) => (
    <ToolCard status={status} result={result} />
  ),
});

4. LangGraph Agent Tools

# agent/agent.py
@tool
async def create_character(
    name: str,
    description: str,
    prompt: str,
    state: Annotated[dict, InjectedState]  # Access shared state
) -> dict:
    api_key = state.get("apiKey", "")
    image_url = await generate_image(prompt, api_key=api_key)
    return {"name": name, "description": description, "imageUrl": image_url}

Deployment

Deploy the agent to Railway:

cd agent
railway link
railway up
railway variables --set "AGENT_URL=https://your-app.up.railway.app"
railway variables --set "GOOGLE_API_KEY=your-key"

See agent/DEPLOY.md for detailed deployment guide.

Tech Stack

Layer Technology
Frontend Next.js 16, React 19, Tailwind CSS 4
AI Integration CopilotKit 1.10.6
Agent Python, LangGraph 0.6.6
LLM Gemini 3 Pro Preview
Image Gen Nano Banana (gemini-2.5-flash-image)

Learn More

License

MIT

Built by Mark Morgan


Note: This project has been consolidated into the CopilotKit monorepo. The latest version lives at examples/showcases/scene-creator. Please open issues and pull requests in the main CopilotKit repository.

评论

暂无评论