From 28da77ce4a75747398717aa42b10d225a23ca8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=205f1b81b8-4f5d-11e8-9c2d-fa7ae01?= =?UTF-8?q?bbebc?= Date: Tue, 30 Jun 2026 16:04:43 +0000 Subject: [PATCH] add: main.py --- main.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..d832cb5 --- /dev/null +++ b/main.py @@ -0,0 +1,46 @@ +import os +import asyncio +from langchain_openai import ChatOpenAI +from langchain_core.messages import HumanMessage +from deepagents import create_deep_agent +from deepagents.backends import FilesystemBackend, LocalShellBackend, CompositeBackend + +# Configure the LLM using OpenRouter +llm = ChatOpenAI( + model="openai/gpt-oss-20b:free", + base_url="https://openrouter.ai/api/v1", + api_key=os.getenv("OPENAI_API_KEY"), + temperature=0.2, +) + +# Set up a composite backend for file and shell interactions (required by deepagents) +backend = CompositeBackend([ + LocalShellBackend(workspace_dir="./workspace"), + FilesystemBackend(), +]) + +# Create the deep agent with a clear system prompt that guides the generation of a 12‑week AI fluency plan +agent = create_deep_agent( + model=llm, + tools=[], + backend=backend, + system_prompt=( + "You are an experienced AI tutor. Your task is to craft a detailed 12‑week personal AI fluency plan " + "for a learner who has completed the Ai Fluency course. The plan should include: 1) a weekly objective, " + "2) recommended resources (books, articles, videos, exercises), and 3) an assessment method for each week. " + "Present the plan in a clear, numbered format." + ), +) + +async def main(): + # Invoke the agent to generate the plan + result = await agent.ainvoke( + {"messages": [HumanMessage(content="Generate my personal AI fluency plan.")]}, + {"configurable": {"thread_id": "ai-fluency-plan"}}, + ) + plan = result["messages"][-1].content + print("\n=== Personal AI Fluency Plan ===\n") + print(plan) + +if __name__ == "__main__": + asyncio.run(main())