initial commit: slides + practica_resueltos + README

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 11:50:55 +02:00
commit 0aff31e2d3
203 changed files with 23207 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
---
layout: default
---
# Context Engineering
<v-clicks>
### Inyección de dependencias en runtime
```typescript
const contextSchema = z.object({
userId: z.string(),
apiKey: z.string(),
});
const fetchUserData = tool(
async ({ query }, runtime: ToolRuntime<any, typeof contextSchema>) => {
const { userId, apiKey } = runtime.context;
return await performQuery(query, apiKey, userId);
},
{ name: "fetch_user_data", schema: z.object({ query: z.string() }) }
);
const agent = createAgent({
model: "gpt-4.1",
tools: [fetchUserData],
contextSchema
});
// Cada usuario tiene su propio contexto
await agent.invoke(messages, {
context: { userId: "user_123", apiKey: "sk-..." }
});
```
</v-clicks>