The Upstreet Agents SDK is now in public beta πŸŽ‰Β Get started β†’
bg-pattern
πŸ“š API ReferenceComponents

<Uniform>

Generate metadata for each action.

The concept is borrowed from Uniforms in a shader.

Import

import { Uniform } from 'react-agents';

Usage

Here's a simple example of using the Uniform component:

import { Uniform, Agent, Action } from 'react-agents';
 
function MyComponent() {
  return (
    <Agent>
      <Uniform
        name="mood"
        description="Current emotional state of the agent"
        handler={(message) => {
          // Analyze message and return mood
          return {
            mood: 'positive',
            confidence: 0.8
          };
        }}
      >
        <Action name="respond" handler={(data) => {
          // Access uniform data in action
          console.log('Current mood:', data.uniform.mood);
        }} />
      </Uniform>
    </Agent>
  );
}

Props

PropTypeDefault
name
string
N/A
description
string
N/A
handler
Function(message) => any
N/A

Best Practices

  • Keep handlers lightweight and efficient
  • Use meaningful names for uniforms
  • Implement proper error handling
  • Cache expensive computations when possible
  • Document the uniform's purpose clearly

Common Use Cases

  • Tracking conversation topics
  • Monitoring agent mood or state
  • Generating consistency metrics
  • Adding timestamps or identifiers
  • Maintaining context across actions

On this page

Facing an issue? Add a ticket.