Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

feat(website): HelloAgent code-block section

xf gong3e61fb4e9136
diff --git a/website/src/components/Home/HelloAgent.module.css b/website/src/components/Home/HelloAgent.module.css
new file mode 100644
index 0000000..e38eb1e
--- /dev/null
+++ b/website/src/components/Home/HelloAgent.module.css
@@ -0,0 +1,6 @@
+.section { max-width: 1080px; margin: 0 auto 64px; padding: 0 24px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; align-items: start; }
+.h2 { font-family: 'Inter Tight'; font-size: 24px; letter-spacing: -0.015em; color: var(--ink-12); margin: 0 0 12px; }
+.lede { font-size: 14px; color: var(--ink-9); line-height: 1.55; margin: 0 0 16px; }
+.link { font-size: 13px; color: var(--accent); }
+.right :global(.theme-code-block) { margin: 0; }
+@media (max-width: 768px) { .section { grid-template-columns: 1fr; gap: 16px; } }
diff --git a/website/src/components/Home/HelloAgent.tsx b/website/src/components/Home/HelloAgent.tsx
new file mode 100644
index 0000000..ae24238
--- /dev/null
+++ b/website/src/components/Home/HelloAgent.tsx
@@ -0,0 +1,57 @@
+import React from 'react';
+import Link from '@docusaurus/Link';
+import CodeBlock from '@theme/CodeBlock';
+import styles from './HelloAgent.module.css';
+
+const SAMPLE = `import asyncio
+from cubepi import Agent, AgentTool, Model
+from cubepi.providers.anthropic import AnthropicProvider
+
+provider = AnthropicProvider(api_key="sk-...")
+
+def get_weather(city: str) -> str:
+ """Get current weather for a city."""
+ return f"72°F and sunny in {city}"
+
+agent = Agent(
+ model=Model(provider=provider, model="claude-sonnet-4-5-20250929"),
+ tools=[AgentTool(
+ name="get_weather",
+ description="Get current weather for a city",
+ parameters={
+ "type": "object",
+ "properties": {"city": {"type": "string"}},
+ "required": ["city"],
+ },
+ execute=get_weather,
+ )],
+ system_prompt="You are a helpful weather assistant.",
+)
+
+async def main():
+ stream = await agent.prompt("What's the weather in Tokyo?")
+ async for event in stream:
+ if event.type == "text_delta":
+ print(event.delta, end="", flush=True)
+
+asyncio.run(main())
+`;
+
+export default function HelloAgent() {
+ return (
+ <section className={styles.section}>
+ <div className={styles.left}>
+ <h2 className={styles.h2}>Hello, agent.</h2>
+ <p className={styles.lede}>
+ A single async function loop. One <code>Provider</code>, one <code>AgentTool</code>, and you're streaming.
+ </p>
+ <Link to="/getting-started/quick-start" className={styles.link}>
+ Full quick-start →
+ </Link>
+ </div>
+ <div className={styles.right}>
+ <CodeBlock language="python">{SAMPLE}</CodeBlock>
+ </div>
+ </section>
+ );
+}